dirs
Show All current record directory stack
-p line shows a directory
-l displayed in the full format
-c delete all records in the directory stack
-v each line to display a directory, with each directory number before
+ N from left to right in the n-th directory number from 0
-N right to left in the n-th directory, numbers from 0 |
pushd
pushd dir_name
The directory is pressed into the top of the stack
popd
The top of the stack eject the current directory stack
cd -
For rapid switching between two directories of the stack
Before executing:
0 / usr / bin /
. 1 / var / log /
After performing:
0 / var / log /
. 1 / usr / bin /
The sample code
#! / bin / bash # following in / var / log / produce sh.log file directory pushd / var / log / pwd echo " tongyishu " > SH .log the popd