linux命令:pwd命令學習與使用,linux命令pwd學習

來源:互聯網
上載者:User

linux命令:pwd命令學習與使用,linux命令pwd學習

Linux中用pwd命令來查看”當前工作目錄“的完整路徑。簡單得說,每當你在終端進行操作時,你都會有一個當前工作目錄。

在不太確定當前位置時,就會使用pwd來判定目前的目錄在檔案系統內的確切位置。

1.命令格式:

pwd[選項]

2.命令功能:

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

3.常用參數:

一般情況下不帶任何參數

如果目錄是連結時:

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

4.常用執行個體:

執行個體1:用pwd命令查看預設工作目錄的完整路徑

命令:

pwd

輸出:

[root@localhost~]#pwd

/root

[root@localhost~]#

執行個體2:使用pwd命令查看指定檔案夾

命令:

pwd

輸出:

[root@localhost~]#cd/opt/soft/

[root@localhostsoft]#pwd

/opt/soft

[root@localhostsoft]#

執行個體三:目錄串連連結時,pwd-P顯示出實際路徑,而非使用串連(link)路徑;pwd顯示的是串連路徑

命令:

pwd-P

輸出:

[root@localhostsoft]#cd/etc/init.d

[root@localhostinit.d]#pwd

/etc/init.d

[root@localhostinit.d]#pwd-P

/etc/rc.d/init.d

[root@localhostinit.d]#

執行個體4:/bin/pwd

命令:

/bin/pwd[選項]

選項:

-L目錄串連連結時,輸出串連路徑

-P輸出實體路徑

輸出:

[root@localhostinit.d]#/bin/pwd

/etc/rc.d/init.d

[root@localhostinit.d]#/bin/pwd–help

[root@localhostinit.d]#/bin/pwd-P

/etc/rc.d/init.d

[root@localhostinit.d]#/bin/pwd-L

/etc/init.d

[root@localhostinit.d]#

執行個體五:目前的目錄被刪除了,而pwd命令仍然顯示那個目錄

輸出:

[root@localhostinit.d]#cd/opt/soft

[root@localhostsoft]#mkdirremoved

[root@localhostsoft]#cdremoved/

[root@localhostremoved]#pwd

/opt/soft/removed

[root@localhostremoved]#rm../removed-rf

[root@localhostremoved]#pwd

/opt/soft/removed

[root@localhostremoved]#/bin/pwd

/bin/pwd:couldn’tfinddirectoryentryin“..”withmatchingi-node

[root@localhostremoved]#cd

[root@localhost~]#pwd

/root

[root@localhost~]#

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.