pwd命令主要用于查看當(dāng)前工作目錄的完整路徑。
主要用法:pwd [option]
常用范例:
1.查看當(dāng)前完整路徑
命令:pwd
輸出:
[root@localhost ~]# pwd
/root
[root@localhost ~]#
2.查看鏈接路徑
命令:pwd -P
輸出:
[root@localhost soft]# cd /etc/init.d
[root@localhost init.d]# pwd
/etc/init.d
[root@localhost init.d]# pwd -P
/etc/rc.d/init.d
特性:當(dāng)前目錄被刪除了,而pwd命令仍然顯示那個(gè)目錄
[root@localhost init.d]# cd /opt/soft
[root@localhost soft]# mkdir removed
[root@localhost soft]# cd removed/
[root@localhost removed]# pwd
/opt/soft/removed
[root@localhost removed]# rm ../removed -rf
[root@localhost removed]# pwd
/opt/soft/removed
[root@localhost removed]# /bin/pwd
/bin/pwd: couldn't find directory entry in “..” with matching i-node
[root@localhost removed]# cd
[root@localhost ~]# pwd
/root
[root@localhost ~]#
以上就是本文的全部內(nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
您可能感興趣的文章:- 每天一個(gè)linux命令 head命令
- linux find命令之xargs簡單概述
- linux find命令之exec簡單概述
- linux命令之find命令簡單概述
- 每天一個(gè)linux命令 chgrp命令
- 詳解Linux文本文件與WIN文本文件換行格式轉(zhuǎn)換命令
- 一個(gè)簡單的linux命令 mv
- 一個(gè)簡單的linux命令 cp
- 一個(gè)簡單的linux命令 touch
- 每天一個(gè)linux命令 whereis命令