Linux命令之pwd命令

2021-10-07 05:36:10 字數 2623 閱讀 3723

一步一步學linux——pwd命令

顯示出 完整的 當前 活動目錄 名稱.

-l

列印 $pwd 變數的值,如果它命名了當前的工作目錄

-p

列印當前的物理路徑,不帶有任何的符號鏈結

預設情況下,pwd 的行為和帶 -l 選項一致

--help

顯示 幫助 資訊, 然後 退出

--version

顯示 版本 資訊, 然後 退出

[deng@localhost ~]$ pwd

/home/deng

[deng@localhost ~]$ cd /usr/src/

[deng@localhost src]$ pwd

/usr/src

[deng@localhost ~]$ ls -l /etc/init.d

lrwxrwxrwx. 1 root root 11 11月 8 2018 /etc/init.d -> rc.d/init.d

[deng@localhost ~]$ cd /etc/init.d

[deng@localhost init.d]$ pwd

/etc/init.d

[deng@localhost init.d]$ pwd -p

/etc/rc.d/init.d

[deng@localhost init.d]$ pwd -l

/etc/init.d

[deng@localhost ~]$ pwd

/home/deng

[deng@localhost ~]$ echo $oldpwd

/etc/init.d

[deng@localhost ~]$ echo $pwd

/home/deng

[deng@localhost ~]$ cd /etc/init.d/

[deng@localhost init.d]$ pwd

/etc/init.d

[deng@localhost init.d]$ echo $oldpwd

/home/deng

[deng@localhost init.d]$ echo $pwd

/etc/init.d

[deng@localhost ~]$ mkdir dir

[deng@localhost ~]$ cd dir

[deng@localhost dir]$ pwd

/home/deng/dir

[deng@localhost dir]$ rm -rf ../dir/

[deng@localhost dir]$ pwd

/home/deng/dir

[deng@localhost dir]$ /usr/bin/pwd

/usr/bin/pwd: 在匹配的inode ".." 上找不到目錄入口

[deng@localhost dir]$ type -a pwd

pwd 是 shell 內嵌

pwd 是 /usr/bin/pwd

[deng@localhost dir]$ /usr/bin/pwd --version

pwd (gnu coreutils) 8.22

許可證:gplv3+:gnu 通用公共許可證第3 版或更新版本。

本軟體是自由軟體:您可以自由修改和重新發布它。

在法律範圍內沒有其他保證。

由jim meyering 編寫。

[deng@localhost dir]$ /usr/bin/pwd --help

用法:/usr/bin/pwd [選項]...

輸出當前工作目錄的完整名稱。

-l, --logical 使用環境變數中的pwd,即使其中包含符號鏈結

-p, --physical 避免所有符號鏈結

--help 顯示此幫助資訊並退出

--version 顯示版本資訊並退出

注意:您的shell 內含自己的pwd 程式版本,它會覆蓋這裡所提及的相應

版本。請查閱您的shell 文件獲知它所支援的選項。

gnu coreutils online help: 請向報告pwd 的翻譯錯誤

要獲取完整文件,請執行:info coreutils 'pwd invocation'

[deng@localhost dir]$

[deng@localhost dir]$ help pwd

pwd: pwd [-lp]

列印當前工作目錄的名字。

選項:-l 列印 $pwd 變數的值,如果它命名了當前的

工作目錄

-p 列印當前的物理路徑,不帶有任何的符號鏈結

預設情況下,`pwd' 的行為和帶 `-l' 選項一致

退出狀態:

除非使用了無效選項或者當前目錄不可讀,否則

返回狀態為0。

linux命令詳解之pwd命令

pwd是print working directory的縮寫,其功能是顯示當前所在工作目錄的全路徑。主要用在當不確定當前所在位置時,通過pwd來檢視當前目錄的絕對路徑。pwd 選項 引數 l logical,顯示當前的路徑,有連線檔案時,直接顯示連線檔案的路徑,不加引數時預設此方式 參考示例1。p ...

Linux常用命令 pwd命令

linux中用 pwd 命令來檢視 當前工作目錄 的完整路徑。簡單得說,每當你在終端進行操作時,你都會有乙個當前工作目錄。在不太確定當前位置時,就會使用pwd來判定當前目錄在檔案系統內的確切位置。1 命令格式 2 命令功能 3 常用引數 一般情況下不帶任何引數 格式 pwd p 顯示出實際路徑,而非...

linux 檔案目錄命令 pwd

1 命令格式 pwd 選項 2 命令功能 檢視 當前工作目錄 的完整路徑 3 常用引數 一般情況下不帶任何引數 如果目錄是鏈結時 格式 pwd p 顯示出實際路徑,而非使用連線 link 路徑。4 常用例項 例項1 用 pwd 命令檢視預設工作目錄的完整路徑 命令 pwd輸出 root localh...