CentOS里pwd命令详解

分类:CentOS教程 阅读:92761 次

pwd(Print Working Directory)

名称: pwd - print name ofcurrent/working directory 输入当前工作路径

语法: pwd [option]

参数: --help --version

实例:

1)显示当前工作路径

[root@localhost ~]# pwd

/root

2)显示出软连接的实际目录,而非使用软连接的目录。参数?P

[root@localhostnetwork-scripts]# cd /etc/init.d

[root@localhostinit.d]# pwd

/etc/init.d

[root@localhostinit.d]# pwd -P

/etc/rc.d/init.d


3)pwd错误显示已经删除的目录

[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 ~]#

----------------------------后续自我小结----------------------------------

pwd命令应该也是功能相对变化比较少的,就是查看我们当前的目录在哪里、-P真实的目录都是在哪里。