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. javascript之数组

    一.定义数组. 定义数组有两个方法: 1.var arr1 = []; //定义一个空数组 2.var arr2 = [1,2,3,"str1","str2"] ...

  2. ubuntu下编译源码级QT

    注意必须好好看官方文档: http://qt-project.org/doc/qt-5/linux.html 包括编译Qt库依赖的包等等. 编译过程中发现以下错误: All the OpenGL fu ...

  3. VS2010常用的调试方法

    1.一直以来都没用过command window, F5以后可以这样用,直接对一个函数,或者变量做模块测试 以下还有一些常用的技巧: 1 悬停鼠标查看表达式值 调试是很有挑战性的.比如在函数内逐步运行 ...

  4. Redis Clients Handling

    This document provides information about how Redis handles clients from the point of view of the net ...

  5. windows phone中,将crash report记录下来,写入文件,方便分析

    APP出现crash(崩溃)总是不能忍的 当我们连接调试器调试的时候,发现每当APP崩溃的时候 程序都会走到App.xaml.cs中的 // Code to execute on Unhandled ...

  6. Volist标签 key值的使用

    Volist标签是thinkphp框架view中常用到的一个标签.主要用于在模板中循环输出数据集或者多维数组.今天使用key属性时出了点问题,记录一下. volist标签(循环输出数据) 闭合 非闭合 ...

  7. PCRE的安装及使用

    摘自http://www.cnblogs.com/renhao/archive/2011/08/17/2143264.html PCRE的安装及使用 1.主页地址:http://www.pcre.or ...

  8. 国际C语言混乱代码大赛代码赏析(一)【转】

    本文转载自:http://blog.csdn.net/ce123_zhouwei/article/details/9073869 国际C语言混乱代码大赛代码赏析(一) 近段时间在看<C专家编程& ...

  9. Python的字符串与数字

    Python3.0通过“input”实现读取控制台的输入与用户实现交互.值得注意的是input接受的所有数据都是字符串,即使输入的是数字,依然会被当作字符串来处理.这就会出现一些问题,所以需要进行类型 ...

  10. Starting httpd:Could not reliably determine the server's fully qualified domain name

    #service httpd start #Starting httpd: httpd: Could not reliably determine the server's fully qualifi ...