When navigating between directories, it is important to know where you are! That is what the
pwd command allows you to do. When the
pwd command is run, the current working directory (the folder that you are in) is printed to the terminal. The path that is printed is the absolute path of the working directory. Let’s try it out. Simply run:
This will return the path of your current working directory, and could look something like this:
ls command, you will find yourself using this command a lot!
pwd provides a quick and easy way to check your working directory, and it especially useful when finding the path of a file you may want to import, or a folder that you want to write to.
At all times, the environment variable
$PWD stores the current working directory. You can verify this by running the following command.