You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
874 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# pushd
## 说明
**pushd命令** 是将目录加入命令堆叠中。如果指令没有指定目录名称,则会将当前的工作目录置入目录堆叠的最顶端。置入目录如果没有指定堆叠的位置,也会置入目录堆叠的最顶端,同时工作目录会自动切换到目录堆叠最顶端的目录去
```bash
-n 只加入目录到堆叠中不进行cd操作
+N 删除从左到右的第n个目录数字从0开始
-N 删除从右到左的第n个目录数字从0开始
```
## 实例
```bash
# 参数--目录:需要压入堆栈的目录
root@Mylinux:/tmp/dir4# pushd /tmp/dir3
/tmp/dir3 /tmp/dir4 /tmp/dir1 ~
root@Mylinux:/tmp/dir3# pushd /tmp/dir2
/tmp/dir2 /tmp/dir3 /tmp/dir4 /tmp/dir1 ~
root@Mylinux:/tmp/dir2# pushd -1
/tmp/dir1 ~ /tmp/dir2 /tmp/dir3 /tmp/dir4
# 注意:最左边表示栈顶,最右边表示栈底
```