Linux学习笔记

pushd

Save and then change the current directory. With no arguments, pushd exchanges the top two directories.

SYNTAX
pushd [dir | +N | -N] [-n]
KEY
+N   Brings the Nth directory (counting from the left of the list
printed by dirs, starting with zero) to the top of the list by
rotating the stack.
-N   Brings the Nth directory (counting from the right of the list
printed by dirs, starting with zero) to the top of the list by
rotating the stack.
-n   Suppresses the normal change of directory when adding directories to the
stack, so that only the stack is manipulated.
dir  Makes the current working directory be the top of the stack, and then executes
the equivalent of `cd dir'. cds to dir.

Related Linux Bash commands:

dirs - Display list of remembered directories
popd - Restore the previous value of the current directory saved by PUSHD

Equivalent Windows XP commands:

PUSHD - Save and then change the current directory

[root@root /var]#pushd .(键入路径名即可)
[root@root /var]#dirs(显示堆栈信息)
/var
[root@root /home]#pushd .
/user/home /var (栈顶为左端,把新的路径压入堆栈栈顶)
[root@root /httpd]#pushd .
/user/home/httpd /user/home /var
[root@root /httpd]#pushd +1(旋转堆栈,来使用第二个路径)
/user/home /var /user/home/httpd
[root@root /httpd]#popd +1
/user/home /user/home/httpd(/var路径被删除)





posted @ 2008-01-27 17:53  ShaDowiCool  阅读(245)  评论(0编辑  收藏  举报