pwd(print name of current/working directory)
打印當前工作目錄
格式
pwd [OPTION]...
參數說明
- -L 打印PWD環境變量,即使存在軟連接
- -P 忽視軟連接,打印物理路徑
- --help 打印幫助信息
- --version 打印版本信息
使用實例
-
pwd軟鏈接路徑與物理路徑測試
[fish@localhost ~]$ ln -s /etc/yum.repos.d/ repo #新建軟連接 [fish@localhost ~]$ ll total 0 lrwxrwxrwx. 1 fish fish 17 Dec 16 19:47 repo -> /etc/yum.repos.d/ [fish@localhost ~]$ cd repo/ [fish@localhost repo]$ pwd #默認情況下為-L選項 /home/fish/repo [fish@localhost repo]$ echo $PWD /home/fish/repo [fish@localhost repo]$ pwd -L #追蹤軟連接路徑 /home/fish/repo [fish@localhost repo]$ pwd -P #追蹤物理路徑 /etc/yum.repos.d
補充知識
- 輸出所有的環境變量可以使用
printenv命令,打印單個的變量可以使用echo $PWD或echo ${PWD}(PWD為變量名,此處$后面的大括號可以省略)
