What is pwd?
‘pwd‘ stands for ‘Print Working Directory‘. As the name states, command ‘pwd‘
prints the current working directory or simply the directory user is,
at present. It prints the current directory name with the complete path
starting from root (/). This command is built in shell command and is available on most of the shell – bash, Bourne shell, ksh,zsh, etc.pwd is one of the simplest yet most popular and most widely used command. A good command over pwd is basic to use Linux terminal.
Basic syntax of pwd:
pwd [OPTION]...
Options used with pwd
-L --logical If the contents of the environment variable PWD provide an absolute name of the
current directory with no "." or ".." components, then output those contents,
even if they contain symbolic links. Otherwise, fall back to default -P handling.
-P --physical Print a fully resolved name for the current directory, in which all components of
the name are actual directory names, and not symbolic links).
--help Display a help message, and exit.
--version Display version information, and exit.
This article aims at providing you a deep insight of Linux command ‘pwd‘.
1. Print your current working directory.
anurag@linuxgosolution:~$ /bin/pwd
/home/anurag
2. Print version of your ‘pwd’ command.
anurag@linuxgosolution:~$ /bin/pwd --version
pwd (GNU coreutils) 8.24
Packaged by Cygwin (8.24-3)
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Jim Meyering.
Important: You might have noticed that we are executing the above command as “/bin/pwd” and not “pwd”.
3. What is the absolute path (starting from /) of the pwd binary file.
/bin/pwd
4. What is the absolute path (starting from /) of the pwd source file.
/usr/include/pwd.h