1、dirs
1)功能
顯示當前目錄棧中的所有記錄(不帶參數的dirs命令顯示當前目錄棧中的記錄)
2)語法
(1)格式:dirs [-clpv] [+n] [-n]
(2)選項
-c 刪除目錄棧中的所有記錄
-l 以完整格式顯示
-p 一個目錄一行的方式顯示
-v 每行一個目錄來顯示目錄棧的內容,每個目錄前加上的編號
+N 顯示從左到右的第n個目錄,數字從0開始
-N 顯示從右到左的第n個日錄,數字從0開始
注意:dirs始終顯示當然目錄, 再是堆棧中的內容;即使目錄堆棧為空, dirs命令仍然只顯示當然目錄
2、pushd
1)功能
pushd命令常用於將目錄加入到棧中,加入記錄到目錄棧頂部,並切換到該目錄;若pushd命令不加任何參數,則會將位於記錄棧最上面的2個目錄對換位置
2)語法
(1)格式:pushd [目錄 | -N | +N] [-n]
(2)選項
目錄 將該目錄加入到棧頂,並執行"cd 目錄",切換到該目錄
+N 將第N個目錄移至棧頂(從左邊數起,數字從0開始)
-N 將第N個目錄移至棧頂(從右邊數起,數字從0開始)
-n 將目錄入棧時,不切換目錄
------------------------------------------------------------------------------------------
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.
3、popd
1)功能
popd用於刪除目錄棧中的記錄;如果popd命令不加任何參數,則會先刪除目錄棧最上面的記錄,然后切換到刪除過后的目錄棧中的最上面的目錄
2)語法
(1)格式:popd [-N | +N] [-n]
(2)選項
+N 將第N個目錄刪除(從左邊數起,數字從0開始)
-N 將第N個目錄刪除(從右邊數起,數字從0開始)
-n 將目錄出棧時,不切換目錄
-------------------------------------------------------------------------------------------
popd
Remove the top entry from the directory stack, and cd
to the new top directory.
SYNTAX popd [+N | -N] [-n] Key +N Remove the Nth directory (counting from the left of the list printed by dirs), starting with zero. -N Remove the Nth directory (counting from the right of the list printed by dirs), starting with zero. -n Suppress the normal change of directory when removing directories from the stack, so that only the stack is manipulated.
When no arguments are given, popd removes the top directory from the stack and performs a cd to the new top directory.
The elements are numbered from 0 starting at the first directory listed with dirs; i.e., popd is equivalent to popd +0.
參考:http://hi.baidu.com/linuxtrip/item/47a38c8eec00e98f4414cfb7