当前位置:首页 / 编程技术 / 运营维护 / 一个简单的linux命令 pwd
一个简单的linux命令 pwd
发布时间:2022/07/10来源:编程网

pwd命令主要用于查看当前工作目录的完整路径。

主要用法:pwd [option]

常用范例:

1.查看当前完整路径

命令: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

特性:当前目录被删除了,而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 ~]#

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持编程网。

分享到:
免责声明:本文仅代表文章作者的个人观点,与本站无关,请读者仅作参考,并自行核实相关内容。文章内容来源于网络,版权归原作者所有,如有侵权请与我们联系,我们将及时删除。
资讯推荐
热门最新
精品工具
全部评论(0)
剩余输入数量90/90
暂无任何评论,欢迎留下你的想法
你可能感兴趣的资讯
换一批