pushd命令 – 添加目录到目录堆栈顶部

pushd命令用于更改新目录并(或)压栈,或者把栈里的某个目录推到栈顶。

语法格式: pushd [参数]

常用参数:

+N把正数第N个放到栈顶
-N把倒数第N个放到栈顶
-n不切换,只压栈
dir要推送的目录

参考实例

添加目录到堆栈,改变了当前工作目录:

[[email protected] ~]# dirs ~ [[email protected] ~]# pushd ~/Desktop ~/Desktop ~ 

添加目录到堆栈,当前工作目录不变:

[[email protected] ~]# dirs ~ [[email protected] ~]# pushd -n ~/Desktop ~ ~/Desktop [[email protected] ~]# pushd -n ~/Pictures ~ ~/Pictures ~/Desktop

调整顺序:

[[email protected] ~]# pushd +1 ~/Pictures ~/Desktop ~ [[email protected] ~]# pushd -1 ~/Desktop ~ ~/Pictures [[email protected] ~]# pushd ~ ~/Desktop ~/Pictures


已发布

分类

作者:

标签