标签:
The pushd
command saves the current working directory in memory so it can be returned to at any time, optionally changing to a new directory.
The popd
command returns to the path at the top of the directory stack. This directory stack is accessed by the command dirs
pushd
pushd [path | ..]
Arguments:
path
This optional command-line argument specifies the directory to make the current directory. If path
is omitted, the path at the top of the directory stack is used, which has the effect of toggling between two directoriespopd
popd
Examples
[fedora@dhcp-129-232 ~]$ pushd Downloads/ # current directory ~ is saved, and ~/Downloads is added to directory stack
~/Downloads ~
[fedora@dhcp-129-232 Downloads]$ dirs # check directory stack
~/Downloads ~
[fedora@dhcp-129-232 Downloads]$ pushd firefox # ~/Downloads/firefox is added to directory stack
~/Downloads/firefox ~/Downloads ~
[fedora@dhcp-129-232 firefox]$ dirs # check directory stack
~/Downloads/firefox ~/Downloads ~
[fedora@dhcp-129-232 firefox]$ popd # go to the top directory "~/Downloads", the first is the top
~/Downloads ~
[fedora@dhcp-129-232 Downloads]$ pwd
/home/fedora/Downloads
标签:
原文地址:http://www.cnblogs.com/penny-jimmy/p/4595625.html