日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

linux shell pushd popd dirs命令

發布時間:2025/4/5 64 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux shell pushd popd dirs命令 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

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.

SYNTAXpushd [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.

SYNTAXpopd [+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

轉載于:https://www.cnblogs.com/davidwang456/p/3784102.html

總結

以上是生活随笔為你收集整理的linux shell pushd popd dirs命令的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。