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命令相关推荐

  1. Linux shell - 目录栈操作(pushd popd dirs)

    说明 使用shell开发一些较为复杂的系统,例如:复杂的编译系统等,可能会遇到类似需求:source 脚本后,在任意目录执行封装好的编译命令,跳转到其它目录执行相应的编译命令,编译完后再跳转回来. 常 ...

  2. Linux: 让切换目录更方便: pushd,popd,dirs,cd -

    一,为何要使用这几个命令?   可能大家会有疑问,为何要使用这几个命令,   难道用cd不就可以切换目录了吗?   没错,使用cd就可以切换到需要访问的目录,   但是有时会是一个路径很长,层次很多的 ...

  3. linux怎么连续退回上次目录?cd - 只能在两个目录间来回切换(autojump)(pushd popd dirs)

    方法1 GitHub 搜索 autojump ,可能会满足你的需求. 参考文章:linux怎么连续退回上次目录? - Nlage的回答 - 知乎 方法2 pushd popd dirs 当进到想保存的 ...

  4. linux shell 中的sleep命令

    开始还以为是这样的语法: sleep(1), 后面发现是: linux shell 中的sleep命令 分类: LINUX 在有的shell(比如linux中的bash)中sleep还支持睡眠(分,小 ...

  5. linux shell 在后台运行命令

    linux shell 在后台运行命令: http://blog.csdn.net/CAIYUNFREEDOM/article/details/6339390 http://blog.sina.com ...

  6. Linux shell 脚本结构化命令 if-then

    shell 脚本结构化命令 1. if-then 语句基本使用 if-then 语句的基本格式: if command thencommands elifcommands elsecommands f ...

  7. Linux shell脚本中的命令正确写法

    shell脚本中的命令需加反引号``

  8. linux+shell+解压命令,linux shell 压缩解压命令

    .tar 解包:tar xvf FileName.tar 打包:tar cvf FileName.tar DirName (注:tar是打包,不是压缩!) --------------- .gz 解压 ...

  9. Linux Shell基础 Bash常见命令 echo命令

    概述 shell中常见的命令echo. 输出命令:echo echo命令的输出内容如果没有特殊含义,则将原内容输出到屏幕:如果输出内容有特殊含义,则输出打印其含义. 命令格式如下: [root@loc ...

最新文章

  1. 【Linux】一步一步学Linux——dpkg-statoverride命令(277)
  2. LiveVideoStackCon 2018推出学生优惠票
  3. 30道经典SQL面试题讲解(1-10)
  4. 从对象角度阐释五行变化
  5. android 多线程 场景,精选Android初中级面试题 (三): 深探Handler,多线程,Bitmap
  6. input标签里面的文字位置
  7. servlet监听器Listener(理论+例子)
  8. 抖音小程序达人入驻壁纸微信小程序安装教程
  9. 03-java制作统计图(柱状,饼状,折线状)
  10. 【ROS入门21讲】订阅者Subscriber的编程使用
  11. eclipse中在包内建包
  12. python+百度地图 实现地址转换为经纬度(全网最简单方法)
  13. 【异常解决】vue项目localhost:8080无法访问此网站或者无法访问此页面,localhost拒绝了我们的连接请求
  14. pyqt5中QGraphicsView弹出菜单
  15. python中的一个好用的文件名操作模块glob
  16. python中单位转换_Python字节单位转换实例
  17. 【效率神器】GH_SelColor 屏幕拾色工具
  18. Figma 中文社区找到了!
  19. Lenovo 联想OEM_Win7主题
  20. 中点画线算法(任意斜率)

热门文章

  1. matlab div矩阵运算,【求助】多维矩阵求和运算!!
  2. ssm 异常捕获 统一处理_统一异常处理介绍及实战
  3. python从入门到实践_Python编程从入门到实践日记Day32
  4. 通达oa oracle数据库,通达OA 2016系统连接ORACLE 11g数据库(图文)
  5. dw上按钮事件 pb_「React TS3 专题」使用 TS 的方式在类组件里定义事件
  6. sql substr切割字符串
  7. sql 精读(一)标准 SQL 中的分析函数概念
  8. 149. Leetcode 1005. K 次取反后最大化的数组和 (贪心算法-基础题目)
  9. 斐波那契问题的递归和动态规划
  10. 推荐系统笔记:决策树回归树