Linux中pwd命令来查看”当前工作目录”的完整路径.简单的说,每当你在终端进行操作时,你都会有一个当前工作目录.在不太确定当前位置时,同样可以使用pwd来判定当前目录在文件系统内的确切位置.

命令格式: pwd  [option]

命令功能: 查看”当前工作目录”的完整路径

常用实例:

<1>查看当前工作目录的完整路径

命令: pwd

eg:

[root@sqj ~]# pwd

/root

<2>显示实际路径,而非使用链接(link)路径

命令: pwd -P

eg:

[root@sqj init.d]# pwd

/etc/init.d

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

/etc/rc.d/init.d

<3>/bin/pwd

命令: /bin/pwd [option]

参数:

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

-P  输出物理路径

eg:

[root@sqj init.d]# pwd

/etc/init.d

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

/etc/rc.d/init.d

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

/etc/init.d

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

/etc/rc.d/init.d

<4>当前目录被删除了,而pwd命令仍然显示那个目录

[root@sqj test]# pwd

/home/test

[root@sqj test]# rm ../test -rf

[root@sqj test]# pwd

/home/test

[root@sqj test]# cd ..

[root@sqj home]# ls

sqj

技术
今日推荐
PPT
阅读数 119
下载桌面版
GitHub
百度网盘(提取码:draw)
Gitee
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:766591547
关注微信