标签:
转自:http://www.cnblogs.com/peida/archive/2012/10/24/2737730.html
Linux中用pwd命令来查看“当前工作目录”的完整路径。简单地说,每当你在终端进行操作时,你都会有一个当前工作目录。
在不太确定当前位置时,就会使用pwd来判定当前目录在文件系统内的确切位置。
pwd []
查看“当前工作目录”的完整路径。
一般情况下不带任何参数。
如果目录是链接时:
格式:pwd -P显示出实际路径,而非使用连接(link)路径。
命令:pwd
输出:
1 [root@localhost ~]# pwd 2 /root 3 [root@localhost ~]#
命令:pwd
输出:
1 [root@localhost ~]# cd /opt/soft/ 2 [root@localhost soft]# pwd 3 /opt/soft 4 [root@localhost soft]#
命令:pwd -P
输出:
1 [root@localhost soft]# cd /etc/init.d 2 [root@localhost init.d]# pwd 3 /etc/init.d 4 [root@localhost init.d]# pwd -P 5 /etc/rc.d/init.d 6 [root@localhost init.d]#
命令:/bin/pwd [选项]
选项:-L目录连接链接时,输出连接路径
-P输出物理路径
输出:
1 [root@localhost init.d]# /bin/pwd 2 /etc/rc.d/init.d 3 [root@localhost init.d]# /bin/pwd --help 4 [root@localhost init.d]# /bin/pwd -P 5 /etc/rc.d/init.d 6 [root@localhost init.d]# /bin/pwd -L 7 /etc/init.d 8 [root@localhost init.d]#
输出:
1 [root@localhost init.d]# cd /opt/soft 2 [root@localhost soft]# mkdir removed 3 [root@localhost soft]# cd removed/ 4 [root@localhost removed]# pwd 5 /opt/soft/removed 6 [root@localhost removed]# rm ../removed -rf 7 [root@localhost removed]# pwd 8 /opt/soft/removed 9 [root@localhost removed]# /bin/pwd 10 /bin/pwd: couldn‘t find directory entry in “..” with matching i-node 11 [root@localhost removed]# cd 12 [root@localhost ~]# pwd 13 /root 14 [root@localhost ~]#
标签:
原文地址:http://www.cnblogs.com/shiguangzhe2013/p/5028064.html