In most shells including bash, pwd is a shell builtin:
$ type -a pwd
pwd is a shell builtin
pwd is /bin/pwd
If you use /bin/pwd, you must use the -L option to get the same result as builtin pwd:
$ ln -s . test
$ cd test && pwd
/home/cuonglm/test
$ /bin/pwd
/home/cuonglm
$ /bin/pwd -L
/home/cuonglm/test
By default, /bin/pwd ignores symlinks and prints the actual directory.
From info pwd:
`-L'
`--logical'
If the contents of the environment variable `PWD' provide an
absolute name of the current directory with no `.' or `..'
components, but possibly with symbolic links, then output those
contents. Otherwise, fall back to default `-P' handling.
`-P'
`--physical'
Print a fully resolved name for the current directory. That is,
all components of the printed name will be actual directory
names--none will be symbolic links.
The built-in pwd includes symlink by default, except that -P option is used, or -o physical set builtin is enabled.
From man bash:
pwd [-LP]
Print the absolute pathname of the current working directory.
The pathname printed contains no symbolic links if the -P option
is supplied or the -o physical option to the set builtin command
is enabled. If the -L option is used, the pathname printed may
contain symbolic links. The return status is 0 unless an error
occurs while reading the name of the current directory or an
invalid option is supplied.
/bin/pwdignores symlink by default, read partinfo pwdin my answer: Print a fully resolved name for the current directory. That is, all components of the printed name will be actual directory names--none will be symbolic links. – cuonglm Jul 19 '14 at 17:13/bin/pwduse-Poption by default. And builtin command has higher precedence than command in system$PATH. – cuonglm Jul 19 '14 at 17:39set -o physical, nowpwdis use-Poption by default, if you don't have-Loption, how do you print the path contains symlink? Read thishttps://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.htmlto know whatset -o physicaldoes. – cuonglm Jul 19 '14 at 17:48/bin/pwdcommand to runpwd?”, the answer is an emphatic *No!* – Scott - Слава Україні Jul 24 '14 at 00:19