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

1.命令格式:

pwd [选项]

2.命令功能:

查看”当前工作目录“的完整路径

3.常用参数:

一般情况下不带任何参数

如果目录是链接时:

格式:pwd -P  显示出实际路径,而非使用连接(link)路径。

4.常用实例:

实例1:用 pwd 命令查看默认工作目录的完整路径命令:pwd

输出:

[root@localhost ~]# pwd

/root

[root@localhost ~]#

实例2:使用 pwd 命令查看指定文件夹命令:pwd

输出:

[root@localhost ~]# cd /opt/soft/

[root@localhost soft]# pwd

/opt/soft

[root@localhost soft]#

实例三:目录连接链接时,pwd -P  显示出实际路径,而非使用连接(link)路径;pwd显示的是连接路

径命令:pwd -P

输出:

[root@localhost soft]# cd /etc/init.d

[root@localhost init.d]# pwd

/etc/init.d

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

/etc/rc.d/init.d

[root@localhost init.d]#

实例4:/bin/pwd 命令:

/bin/pwd [选项]

选项:

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

-P 输出物理路径

输出:

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

/etc/rc.d/init.d

[root@localhost init.d]# /bin/pwd --help

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

/etc/rc.d/init.d

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

/etc/init.d

[root@localhost init.d]#

实例五:当前目录被删除了,而pwd命令仍然显示那个目录

输出:

[root@localhost init.d]# cd /opt/soft

[root@localhost soft]# mkdir removed

[root@localhost soft]# cd removed/

[root@localhost removed]# pwd

/opt/soft/removed

[root@localhost removed]# rm ../removed -rf

[root@localhost removed]# pwd

/opt/soft/removed

[root@localhost removed]# /bin/pwd

/bin/pwd: couldn't find directory entry in “..” with matching i-node

[root@localhost removed]# cd

[root@localhost ~]# pwd

/root

[root@localhost ~]#

linux命令之pwd(print working drectory)的更多相关文章

  1. 每天一个LINUX命令(pwd)

    每天一个LINUX命令(pwd) 基本信息 pwd: /bin/pwd,显示当前路径的绝对路径         语法:pwd 应用程序位置     which pwd PWD作用 pwd --help ...

  2. linux命令:pwd

    1.介绍: pwd可以查看目录的完整路径,全称是Print Working Directory,. 2.命令格式 pwd [选项] 3.命令作用 查看目录的完整路径 4.常用选项 -L 当路径为链接路 ...

  3. 每天一个linux命令(1):pwd命令

    1.命令简介 pwd(print work directory 打印当前目录)命令以绝对路径的方式显示用户当前工作目录. 2.用法 pwd [-LP] 3.选项 -L --logical 当目录为连接 ...

  4. 每天一个linux命令:pwd命令

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

  5. 20155322 2017-2018-1《信息安全系统设计》第九周 Linux命令:pwd命令学习与简单实现

    pwd命令学习 功能 Linux中用 pwd 命令来查看"当前工作目录"的完整路径. 格式 pwd [选项] 实例 用 pwd 命令查看默认工作目录的完整路径: 用 pwd 命令查 ...

  6. linux 命令——3 pwd (转)

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

  7. Linux命令之---pwd

    命令简介 Linux中用 pwd 命令用来查看”当前工作目录“的完整路径. 命令格式 pwd [选项] 命令功能和参数 功能:查看”当前工作目录“的完整路径:参数:一般情况下不带任何参数,如果目录是链 ...

  8. 每天一个Linux命令:pwd(3)

    pwd pwd是Print Working Directory的缩写,其功能是显示当前所在工作目录的全路径.主要用在当不确定当前所在位置时,通过pwd来查看当前目录的绝对路径 格式 pwd [选项] ...

  9. Linux命令之pwd

    从今天开始,我会慢慢的把学习Linux过程中的一些命令简单的介绍一下,只是简单的介绍. 我的系统是Ubantu pwd命令 用处:查看当前所在的目录 用法:直接在终端里面输入pwd就好了 示例:

随机推荐

  1. tr 替换删除字符

    1.关于tr    通过使用 tr,您可以非常容易地实现 sed 的许多最基本功能.您可以将 tr 看作为 sed 的(极其)简化的变体:它可以用一个字符来替换另一个字符,或者可以完全除去一些字符.您 ...

  2. cf478D Red-Green Towers

    D. Red-Green Towers time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  3. Cuckoo hash算法分析

    一 基本思想: cuckoo hash是一种解决hash冲突的方法,其目的是使用简单的hash 函数来提高hash table的利用率,同时保证O(1)的查询时间 基本思想是使用2个hash函数来处理 ...

  4. ZOJ3414Trail Walk(计算几何)

    Trail Walk Time Limit: 2 Seconds      Memory Limit: 65536 KB FatMouse is busy organizing the coming ...

  5. Difference Between Mod_Python & Mod_Wsgi | eHow

    Difference Between Mod_Python & Mod_Wsgi | eHow     x    YES    NO    Why not?     Thanks for he ...

  6. python3 时间和日期

    Python程序可以通过多种方式来处理日期和时间.日期格式之间的转换是计算机的一个共同核心.Python的时间和日历模块能够帮助我们跟踪的日期和时间. 什么是刻度? 时间间隔以秒为单位的浮点数.特别是 ...

  7. Struts2(一)——总体介绍

    这篇博客开始将总结一下有关框架的知识,在开发中合适的利用框架会使我们的开发效率大大提高.当今比较流行的开源框架: 关注数据流程的MVC框架 (Struts1/2, WebWork, Spring MV ...

  8. swift中通知的使用

    1.发通知.(以这条通知为例,通知名字:gameOverNotification.通知参数:title) NSNotificationCenter.defaultCenter().postNotifi ...

  9. 关于 jsp:include 传参的用法

    引用模版页面的代码,如下: <jsp:include page="/WEB-INF/template/nav_template.jsp">     <jsp:pa ...

  10. 设置grub密码

    一,明文加密的方法 vi /etc/grub.conf 在hiddenmenu下添加password=1234,保存退出. 二,密文加密的方法 2.1, 使用SHA加密方式.grub-crypt  回 ...