一般情況下不帶任何參數(shù)。
格式:pwd
如果目錄是鏈接時。
格式:pwd -P 顯示出實際路徑,而非使用連接(link)路徑。
示例一 root用戶
Last login: Tue Nov 2 19:15:53 2010 from 222.70.145.185
[root@web ~]# pwd
/root
[root@web ~]# echo $OLDPWD
[root@web ~]# echo $PWD
/root
[root@web ~]# cd /etc/init.d
[root@web init.d]# pwd
/etc/init.d
[root@web init.d]# echo $OLDPWD
/root
[root@web init.d]# echo $PWD
/etc/init.d
[root@web init.d]#
示例二 普通用戶
Last login: Fri Oct 29 16:18:50 2010 from hnas1
[web@hnweb1 ~]$ pwd
/home/web
[web@hnweb1 ~]$ echo $OLDPWD
[web@hnweb1 ~]$ echo $PWD
/home/web
[web@hnweb1 ~]$ cd work
[web@hnweb1 work]$ pwd
/home/web/work
[web@hnweb1 work]$ echo $OLDPWD
/home/web
[web@hnweb1 work]$ echo $PWD
/home/web/work
[web@hnweb1 work]$
示例三 如果目錄是個符號鏈接
[root@web ~]# cd /var/mail
[root@web mail]# pwd
/var/mail
[root@web mail]# pwd -P
/var/spool/mail
[root@web mail]# pwd -L
/var/mail
[root@web mail]# ls -l /var/mail
lrwxrwxrwx 1 root root 10 06-28 17:21 /var/mail -> spool/mail
[root@web mail]#
# 當前目錄保存到變量D中 D=$(pwd) # 根據(jù)當前目錄得到上級目錄 P=$(dirname $D) # 打印當前目錄和上級目錄 echo D=$D P=$P
[root@web setup]# D=$(pwd)
[root@web setup]# P=$(dirname $D)
[root@web setup]# echo D=$D P=$P
D=/root/setup P=/root
[root@web setup]#
[root@web init.d]# type -a pwd
pwd is a shell builtin
pwd is /bin/pwd
[root@web init.d]# /bin/pwd
/etc/rc.d/init.d
[root@web init.d]# /bin/pwd --help
用法:/bin/pwd [選項]
打印當前工作目錄的完整文件名。
--help 顯示此幫助信息并退出
--version 輸出版本信息并退出
however, most of the resampling methods entail asymmetric changes to the examples of different classes, which in turn can introduce its own biases in the model。