🐧 Linux / Shell Scripting
Beginner
How do you display the current working directory?
Answer
Use the pwd (print working directory) command. It outputs the full absolute path of the directory you are currently in. For example, if you are in your home folder it prints /home/username. The -P flag resolves symbolic links and prints the physical path. The current directory is also stored in the $PWD environment variable, so echo $PWD gives the same result. This is useful in scripts to determine the script's working context.