代码改变世界

Linux命令学习总结:pwd命令

2013-11-15 14:14  潇湘隐者  阅读(14735)  评论(0编辑  收藏  举报

命令简介:

    该命令用来显示目前所在的工作目录。指令英文原义:print work directory

    执行权限    :All User

    指令所在路径:/usr/bin/pwd 或 /bin/pwd

命令语法:


    pwd [OPTION]...

命令参数: 

参数

长参数

描叙

-L

--logical(无效)

当目录为连接路径时,显示连接路径

-P

--physical(无效)

显示实际物理路径,而非使用连接(link)路径

--help

显示命令在线帮助(该参数无法使用)

--version

显示命令版本信息(该参数无法使用)

使用示例:
 

1:查看pwd命令的帮助信息

   1: root@DB-Server init.d]# man pwd 
   2: PWD(1)                           User Commands                          PWD(1)
   3:  
   4: NAME 
   5:        pwd - print name of current/working directory
   6:  
   7: SYNOPSIS 
   8:        pwd [OPTION]...
   9:  
  10: DESCRIPTION 
  11:        Print the full filename of the current working directory.
  12:  
  13:        -L, --logical 
  14:               use PWD from environment, even if it contains symlinks
  15:  
  16:        -P, --physical 
  17:               avoid all symlinks
  18:  
  19:        --help display this help and exit
  20:  
  21:        --version 
  22:               output version information and exit
  23:  
  24:        NOTE:  your  shell  may  have  its  own version of pwd, which usually supersedes the version described here.  Please refer to your shell鈥檚 documentation for details about the 
  25:        options it supports.
  26:  
  27: AUTHOR 
  28:        Written by Jim Meyering.
  29:  
  30: REPORTING BUGS 
  31:        Report bugs to <bug-coreutils@gnu.org>.
  32:  
  33: COPYRIGHT 
  34:        Copyright 漏 2006 Free Software Foundation, Inc. 
  35:        This is free software.  You may redistribute copies of it under the terms of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.  There is NO WARRANTY,  to 
  36:        the extent permitted by law.
  37:  
  38: SEE ALSO 
  39:        The full documentation for pwd is maintained as a Texinfo manual.  If the info and pwd programs are properly installed at your site, the command
  40:  
  41:               info pwd
  42:  
  43:        should give you access to the complete manual.
  44:  
  45: pwd 5.97                           May 2011                             PWD(1) 
  46: (END) 
  47:  

2:显示当前目录所在路径 pwd

   1: [root@DB-Server networking]# pwd 
   2: /etc/sysconfig/networking


3:显示当前目录的物理路径 pwd –P

   1: [root@DB-Server init.d]# cd /etc/init.d 
   2: [root@DB-Server init.d]# pwd -P 
   3: /etc/rc.d/init.d


4: 显示当前目录的连接路径:pwd -L

   1: [root@DB-Server networking]# cd /etc/init.d 
   2: [root@DB-Server init.d]# pwd -L 
   3: /etc/init.d 
   4: [root@DB-Server init.d]# pwd 
   5: /etc/init.d