pwd [选项]
以绝对路径的方式显示用户当前工作目录
(1).选项
-L,–logical 显示运行环境的目录(当前目录),即使它包含链接
-P,–physical 显示当前目录的实际物理地址,避免所有链接
(2).实例
/bin/pwd与pwd命令只有以下的区别:(当前目录被删除pwd命令仍会显示这个目录,而/bin/pwd不会)
[[email protected] 桌面]# mkdir pwd [[email protected] 桌面]# cd pwd [[email protected] pwd]# /bin/pwd /root/桌面/pwd [[email protected] pwd]# pwd /root/桌面/pwd [[email protected] pwd]# rmdir ../pwd [[email protected] pwd]# pwd /root/桌面/pwd [[email protected] pwd]# /bin/pwd /bin/pwd: 在匹配的inode ".." 上找不到目录入口 [[email protected] pwd]# cd .. [[email protected] 桌面]# ll 总用量 0
pwd查看完整路径,当有链接时pwd -P显示出实际物理路径,而pwd -L和pwd一样效果
[[email protected] 桌面]# pwd /root/桌面 [[email protected] 桌面]# cd /etc/init.d/ [[email protected] init.d]# pwd /etc/init.d [[email protected] init.d]# pwd -P /etc/rc.d/init.d
[[email protected] init.d]# pwd -L
/etc/init.d
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/2871.html