pwd命令

【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

转载于:https://www.cnblogs.com/topaz1618/p/4631223.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值