1.功能说明

  pwd命令是“print working directory ”首字母缩写,显示当前目录的绝对路径。

2.语法格式

  pwd [option]

  pwd 选项

3.命令参数

参数

参数说明

-L

当目录是链接(目录快捷方式)时,显示连接文件路径

-P

输出物理路径

说明:当一个目录有链接文件时,pwd输出当前路径


4.使用范例

范例1 :不带任何选项执行pwd命令

[root@localhost ~]# pwd

/root

[root@localhost ~]# cd /etc/sysconfig/

[root@localhost sysconfig]# pwd

/etc/sysconfig

范例2:在链接目录下,输出链接文件的路径,输出物理路径

[cxf@localhost ~]$ ls -ld /etc/init.d

lrwxrwxrwx. 1 root root 11 Jul 31  2017 /etc/init.d -> rc.d/init.d   l:表示链接文件标识符;/etc/init.d指向的真实路径是/etc/rc.d/init.d

[cxf@localhost ~]$ cd /etc/init.d

[cxf@localhost init.d]$ pwd

/etc/init.d        #默认情况下pwd显示链接文件的真实路径

[cxf@localhost ~]$ cd /etc/init.d

[cxf@localhost init.d]$ pwd -L

/etc/init.d

[cxf@localhost init.d]$ pwd -P

/etc/rc.d/init.d

范例3:/etc/init.d是/etc/rc.d/init.d的链接文件,在/etc/init.d目录,pwd默认显示链接文件路径,如若需要输出物理路径,需要-P

[cxf@localhost init.d]$ cd /etc/init.d

[cxf@localhost init.d]$ pwd

/etc/init.d

[cxf@localhost init.d]$ pwd -L

/etc/init.d

[cxf@localhost init.d]$ pwd –P     #显示物理路径

/etc/rc.d/init.d

...........................

[cxf@localhost init.d]$ cd /etc/rc.d/init.d/

[cxf@localhost init.d]$ pwd

/etc/rc.d/init.d

[cxf@localhost init.d]$ pwd -P

/etc/rc.d/init.d

[cxf@localhost init.d]$ pwd -L

/etc/rc.d/init.d

注:在物理路径下,pwd –L 是不能输出链接文件路径;在链接文件目录下,pwd –P能输出物理路径。

最新文章

  1. 一些关于 checkbox的前台 jquery 操作 记录
  2. iOS,自动布局autoresizing和auto layout,VFL语言
  3. 我的Unity学习路线
  4. NoSQL你知多少?
  5. 在同个工程中使用 Swift 和 Objective-C(Swift 2.0更新)-b
  6. 深入浅出—JAVA(10)
  7. 【每天一道算法题】Numeric Keypad
  8. tensorflow (七) k-means
  9. D. GukiZ and Binary Operations(矩阵+二进制)
  10. navicat激活
  11. 串行动画组QSequentialAnimationGroup
  12. 造轮子和用轮子:快速入门JavaScript模块化
  13. BZOJ.5137.Standing Out from the Herd(广义后缀自动机)
  14. Python使用suds调用webservice报错解决方法:AttributeError: 'Document' object has no attribute 'set'
  15. Java中sleep方法和wait的详细区别
  16. 用JavaScript来生成HTML
  17. Spring 在+publicId+和+systemId+之间需要有空格
  18. P2894 [USACO08FEB]酒店Hotel 线段树
  19. log4j每天,每小时产生一日志文件
  20. Docker图形界面管理之Portainer

热门文章

  1. wnmp部署
  2. WCF - Home
  3. db2用户权限赋值
  4. 使用JS将图片转为Base64
  5. Markdown编辑器editor.md的使用
  6. selenium元素定位之css选择器
  7. 【MM系列】SAP MM模块-基础配置第一篇
  8. 分布式ID生成器 snowflake(雪花)算法
  9. Node.js实战8:可用于压缩、加密的zlib。
  10. ceph部署-基础部署