Linux pwd
command is the acronym of the print working directory
. This command is a very old and popular command. This command does do not have a lot of features. But the features it has are very useful for us. Pwd is supported by Linux, AIX, HP-UX, BSD, UNIX.
Print Current Working Directory
The ultimate usage is printing the current working directory into the terminal. We will just issue the pwd
command .
$ pwd
Assign Current Working Directory To Shell Variable
Another popular usage is setting the current working directory value or full path into a shell variable. We will run pwd
command in a new shell and assign the returning value into current shells variable name mypath
.
$ mypath=$(pwd)