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