pwd.1

PWD(1)

PWD(1)

FreeBSD General Commands Manual

PWD(1)

pwd

return working directory name

pwd [-L | -P]

pwd 实用程序将当前工作目录的绝对路径名写入标准输出。

某些 shell 可能提供与此实用程序类似或相同的内置 pwd 命令。 请参阅 builtin(1) 手册页。

选项如下:

-L

显示逻辑当前工作目录。

-P

显示当前的物理工作目录(所有符号链接都已解析)。

如果未指定任何选项,则假定使用 -P 选项。

pwd 使用的环境变量:

PWD

逻辑当前工作目录。

The pwd utility exits 0 on success, and >0 if an error occurs.

显示已解析符号链接的当前工作目录:

$ /bin/pwd /usr/home/fernape

显示逻辑当前目录。然后使用 file(1) 检查 /home 目录:

$ /bin/pwd -L /home/fernape $ file /home /home: symbolic link to usr/home

builtin(1), cd(1), csh(1), realpath(1), sh(1), getcwd(3)

pwd 实用程序符合 IEEE Std 1003.1-2001 (“POSIX.1”) 。

pwd 命令出现在 Version 5 AT&T UNIX 中。

在 csh(1) 中,命令 dirs 总是更快,因为它内置在该 shell 中。 但是,在 shell 下降到当前目录或包含目录之后移动的极少数情况下,它可以给出不同的答案。

除非 shell 导出 PWD 环境变量,否则 -L 选项不起作用。

October 24, 2020

FreeBSD 13.1-RELEASE

最后更新于

FreeBSD 中文社区