Stands for the print work directory. This command will output the full path of the current current directory. It only takes a couple of options -P
and -L
which resolve directories for Symbolic links.
General syntax for pwd
command:
$ pwd [OPTION...]
Display physical directory without symlinks
pwd -P
The -P
option only prints the absolute path of the directory, avoiding symbolic links in the output.
Example: Printing the absolute path by replacing the SymLink with the ExampleDir directory.
Display working directory with symlinks
pwd -L
This option prints the path to the current working directory, including symlinks.
Example: Located in SymLink, let’s run the command to see the output with a symbolic link.
Display variable content
var=$(pwd)
Store the value of the pwd
command in a variable.
Example: Storing the value of the pwd
command in the NewVar variable and displaying its value from this variable.
Display previous working directory
echo "$OLDPWD"
Use this command to print the previous working directory path.
Example: Checking the previous location (Desktop/ExampleDir) in the file system and outputting it.
The post How to Use pwd Command in Linux appeared first on Hongkiat.
from Signage https://ift.tt/flzSK16
via Irvine Sign Company