系統(tǒng)之家 - 系統(tǒng)光盤下載網(wǎng)站!

當前位置:系統(tǒng)之家 > 系統(tǒng)教程 > Linux pwd命令

Linux中pwd命令有什么用?

時間:2014-12-04 15:23:11 作者:qipeng 來源:系統(tǒng)之家 1. 掃描二維碼隨時看資訊 2. 請使用手機瀏覽器訪問: https://m.xitongzhijia.net/xtjc/20141204/31920.html 手機查看 評論

  Linux pwd命令主要用于打印當前工作目錄的工作路徑, 如果你想要使用pwd命令,就要對pwd命令的用法十分了解,下面小編就給大家介紹下Linux中的pwd命令。

 Linux中pwd命令有什么用?

  在不太確定當前位置時,就會使用pwd來判定當前目錄在文件系統(tǒng)內的確切位置。

  1.命令格式:

  pwd [選項]

  2.命令功能:

  查看”當前工作目錄“的完整路徑

  3.常用參數(shù):

  一般情況下不帶任何參數(shù)

  如果目錄是鏈接時:

  格式:pwd -P 顯示出實際路徑,而非使用連接(link)路徑。

  4.常用實例:

  實例1:用 pwd 命令查看默認工作目錄的完整路徑

  命令:

  pwd

  輸出:

 。踨oot@localhost ~]# pwd

  /root

  [root@localhost ~]#

  實例2:使用 pwd 命令查看指定文件夾

  命令:

  pwd

  輸出:

 。踨oot@localhost ~]# cd /opt/soft/

  [root@localhost soft]# pwd

  /opt/soft

 。踨oot@localhost soft]#

  實例三:目錄連接鏈接時,pwd -P 顯示出實際路徑,而非使用連接(link)路徑;pwd顯示的是連接路徑

  命令:

  pwd -P

  輸出:

 。踨oot@localhost soft]# cd /etc/init.d

 。踨oot@localhost init.d]# pwd

  /etc/init.d

 。踨oot@localhost init.d]# pwd -P

  /etc/rc.d/init.d

 。踨oot@localhost init.d]#

  實例4:/bin/pwd

  命令:

  /bin/pwd [選項]

  選項:

  -L 目錄連接鏈接時,輸出連接路徑

  -P 輸出物理路徑

  輸出:

  [root@localhost init.d]# /bin/pwd

  /etc/rc.d/init.d

 。踨oot@localhost init.d]# /bin/pwd --help

 。踨oot@localhost init.d]# /bin/pwd -P

  /etc/rc.d/init.d

 。踨oot@localhost init.d]# /bin/pwd -L

  /etc/init.d

 。踨oot@localhost init.d]#

  實例五:當前目錄被刪除了,而pwd命令仍然顯示那個目錄

  輸出:

 。踨oot@localhost init.d]# cd /opt/soft

  [root@localhost soft]# mkdir removed

 。踨oot@localhost soft]# cd removed/

  [root@localhost removed]# pwd

  /opt/soft/removed

 。踨oot@localhost removed]# rm 。。/removed -rf

 。踨oot@localhost removed]# pwd

  /opt/soft/removed

  [root@localhost removed]# /bin/pwd

  /bin/pwd: couldn‘t find directory entry in “。。” with matching i-node

 。踨oot@localhost removed]# cd

 。踨oot@localhost ~]# pwd

  /root

 。踨oot@localhost ~]#

  上面就是Linux pwd命令的用法介紹了,當你不太確定當前目錄的確切位置的時候,就可以使用pwd命令來查看路徑,趕緊試試看吧。

發(fā)表評論

0

沒有更多評論了

評論就這些咯,讓大家也知道你的獨特見解

立即評論

以上留言僅代表用戶個人觀點,不代表系統(tǒng)之家立場

其他版本軟件

熱門教程

人氣教程排行

Linux系統(tǒng)推薦

官方交流群 軟件收錄