pwd
瑞兹 发表于 2020-11-18 09:37浏览次数:
在类似Unix的操作系统上,pwd命令输出工作目录的名称。
On Unix-like operating systems, the pwd command outputs the name of the working directory.
目录:
1 pwd 运行系统环境
2 pwd 描述
3 pwd 语法
4 pwd 例子
pwd 运行系统环境
pwd 描述
根据运行的是独立命令还是外壳程序中包含的内置pwd命令,pwd的默认行为略有不同。如果使用的是bash shell,则可以使用type命令确定默认的pwd:
type pwd
pwd is a shell built-in
要指定您要运行独立程序而不是内置的shell,请在命令中使用其完整路径:
/bin/pwd
本文档描述了pwd的GNU / Linux独立版本。
The default behavior of pwd is slightly different depending on if you are running the stand-alone command, or the built-in pwd command that is included in your shell. If you are using the bash shell, you can determine which pwd is the default with the type command:
type pwd
pwd is a shell built-in
To specify that you want to run the stand-alone program instead of the shell built-in, use its complete path in the command:
/bin/pwd
This document describes the GNU/Linux stand-alone version of pwd.
pwd 语法
pwd [OPTION]...
选件
-L, --logical
|
如果环境变量 PWD包含当前目录的绝对名称,并且不包含任何“ . ”或“ .. ”组件,则输出这些内容,即使它们包含符号链接也是如此。否则,请恢复为默认(-P)行为。
|
-P, --physical
|
打印当前目录的完全解析名称,该名称的所有组成部分均为实际目录名称,而不是符号链接。
|
-- help
|
显示帮助消息,然后退出。
|
-- version
|
显示版本信息,然后退出。
|
pwd [OPTION]...
Options
-L,
--logical
|
If the environment variable PWD contains 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) behavior.
|
-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.
|
pwd 例子
pwd
打印工作目录的名称。如果路径中的任何子目录都是符号链接,并且在更改目录时使用了符号链接名称,则将打印符号链接名称。输出示例:
/home/hope/mysymlink/mydir
pwd -P
使用目录组件的实际名称打印工作目录的名称,即使在更改目录时使用了它们的符号链接名称也是如此。输出示例:
/home/hope/actual_directory_name/actual_subdirectory/mydir
pwd
Print the name of the working directory. If any of the subdirectories in the path are symbolic links, and you used the symlink names when changing to the directory, the symlink names are printed. Example output:
/home/hope/mysymlink/mydir
pwd -P
Print the name of the working directory, using the actual names of the directory components, even if their symlink names were used when changing to the directory. Example output:
/home/hope/actual_directory_name/actual_subdirectory/mydir