- 工信部备案号 滇ICP备05000110号-1
- 滇公安备案 滇53010302000111
- 增值电信业务经营许可证 B1.B2-20181647、滇B1.B2-20190004
- 云南互联网协会理事单位
- 安全联盟认证网站身份V标记
- 域名注册服务机构许可:滇D3-20230001
- 代理域名注册服务机构:新网数码
pwd工具打印当前/当前工作目录的名称(PWD - 当前工作目录,得到它?)。 以下是它的语法:
pwd [OPTION]...
下面是该工具的手册页如何描述它:
Print the full filename of the current working directory.
以下是一些Q&A样式的示例,应该能够让您了解pwd命令的工作原理。
Q1。 pwd命令如何工作?
通常情况下,基本用法非常简单。 您只需运行“pwd”命令而不用任何选项,您将在输出中获得当前工作目录的完整路径。
pwd
这是一个例子:
himanshu@ansh:~$ pwd
/home/himanshu
值得一提的是,大多数shell,包括bash,都已经内建了。 只需执行以下命令:
type -a pwd
你应该得到以下输出。
pwd is a shell builtin
pwd is /bin/pwd
Q2。 pwd和/ bin / pwd有什么区别?
那么,pwd是内置的shell,而/ bin / pwd是Linux发行版附带的工具。 PWD的手册页清楚地说明了这一点:
NOTE: Your shell may have its own version of pwd, which usually supersedes the version described
here. Please refer to your shell's documentation for details about the options it supports.
Q3。 如何使pwd从环境中使用PWD?
这可以使用-L命令行选项完成。 为了测试这个,创建一个到当前目录的符号链接(在我的情况下是/ home / himanshu)。
例如:
ln -s . dir_symlink
然后输入它:
cd dir_symlink
现在,运行以下命令:
/bin/pwd
在我的情况下,得到了以下输出:
/home/himanshu
接下来,执行这个命令
/bin/pwd -L
我得到了以下输出:
/home/himanshu/dir_symlink
Q4。 如何使pwd避免所有的符号链接?
这可以使用-P命令行选项完成。 例如:
/bin/pwd -L
产生以下输出:
/home/himanshu/dir_symlink
但是用-P
/bin/pwd -L -P
输出是:
/home/himanshu
值得一提的是,如果没有指定选项,默认情况下是-P
售前咨询
售后咨询
备案咨询
二维码
TOP