日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux shell pushd popd dirs命令

發(fā)布時(shí)間:2025/4/5 linux 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux shell pushd popd dirs命令 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

1、dirs

1)功能
顯示當(dāng)前目錄棧中的所有記錄(不帶參數(shù)的dirs命令顯示當(dāng)前目錄棧中的記錄)

2)語法
(1)格式:dirs? [-clpv]? [+n]? [-n]
(2)選項(xiàng)
-c ?? 刪除目錄棧中的所有記錄
-l???? 以完整格式顯示
-p??? 一個(gè)目錄一行的方式顯示
-v??? 每行一個(gè)目錄來顯示目錄棧的內(nèi)容,每個(gè)目錄前加上的編號
+N? 顯示從左到右的第n個(gè)目錄,數(shù)字從0開始
-N?? 顯示從右到左的第n個(gè)日錄,數(shù)字從0開始
注意:dirs始終顯示當(dāng)然目錄, 再是堆棧中的內(nèi)容;即使目錄堆棧為空, dirs命令仍然只顯示當(dāng)然目錄

2、pushd

1)功能
pushd命令常用于將目錄加入到棧中,加入記錄到目錄棧頂部,并切換到該目錄;若pushd命令不加任何參數(shù),則會將位于記錄棧最上面的2個(gè)目錄對換位置

2)語法
(1)格式:pushd? [目錄 | -N | +N]?? [-n]
(2)選項(xiàng)
目錄?? 將該目錄加入到棧頂,并執(zhí)行"cd 目錄",切換到該目錄
+N?? 將第N個(gè)目錄移至棧頂(從左邊數(shù)起,數(shù)字從0開始)
-N??? 將第N個(gè)目錄移至棧頂(從右邊數(shù)起,數(shù)字從0開始)
-n??? 將目錄入棧時(shí),不切換目錄

------------------------------------------------------------------------------------------

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命令不加任何參數(shù),則會先刪除目錄棧最上面的記錄,然后切換到刪除過后的目錄棧中的最上面的目錄

2)語法
(1)格式:popd? [-N | +N]?? [-n]
(2)選項(xiàng)
+N?? 將第N個(gè)目錄刪除(從左邊數(shù)起,數(shù)字從0開始)
-N??? 將第N個(gè)目錄刪除(從右邊數(shù)起,數(shù)字從0開始)
-n??? 將目錄出棧時(shí),不切換目錄

?-------------------------------------------------------------------------------------------

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

轉(zhuǎn)載于:https://www.cnblogs.com/davidwang456/p/3784102.html

總結(jié)

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

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。