码迷,mamicode.com
首页 > 其他好文 > 详细

pwd命令

时间:2015-07-08 20:54:10      阅读:103      评论:0      收藏:0      [点我收藏+]

标签:

【pwd】      打印当前的工作目录             pwd==print work director

命令格式:

pwd [OPTION]...

命令功能:

打印当前工作目录的全路径

命令参数:

-L, --logical               目录连接链接时,输出连接路径

-P, --physical            输出物理路径

命令实例:

实例1:查看当前路径

命令:

pwd

输出:

[root@localhost ~]# pwd

/root

实例2:目录连接链接时,pwd -P  显示出实际路径,而非使用连接(link)路径;pwd显示的是连接路径

命令:pwd -P

输出:

[root@localhost init.d]# pwd

/etc/init.d

[root@localhost init.d]# pwd -P

/etc/rc.d/init.d

[root@localhost init.d]# ll

lrwxrwxrwx.  1 root root     11 Jul  5 09:38 init.d -> rc.d/init.d

实例3:/bin/pwd

输出:

[root@localhost init.d]# /bin/pwd

/etc/rc.d/init.d

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

/etc/rc.d/init.d

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

/etc/init.d

实例4:当前目录被删除了,而pwd命令仍然显示那个目录,/bin/pwd不显示

命令:

pwd /bin/pwd

输出:

[root@localhost hello]# pwd

/nihao/hello   

[root@localhost hello]# /bin/pwd

/nihao/hello

[root@localhost hello]# rm -rf ../hello/

[root@localhost hello]# pwd

/nihao/hello

[root@localhost hello]# /bin/pwd

/bin/pwd: couldn‘t find directory entry in `..‘ with matching i-node

pwd命令

标签:

原文地址:http://www.cnblogs.com/topaz1618/p/4631223.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!