2019-04-21 11:50:48 +08:00

24 lines
1.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<h1 id="pushd">pushd</h1>
<p>将目录加入命令堆叠中</p>
<h2 id="补充说明">补充说明</h2>
<p><strong>pushd命令</strong> 是将目录加入命令堆叠中。如果指令没有指定目录名称,则会将当前的工作目录置入目录堆叠的最顶端。置入目录如果没有指定堆叠的位置,也会置入目录堆叠的最顶端,同时工作目录会自动切换到目录堆叠最顶端的目录去。</p>
<h3 id="语法">语法</h3>
<pre><code class="language-bash">pushd(选项)(参数)</code></pre>
<h3 id="选项">选项</h3>
<pre><code class="language-bash">-n只加入目录到堆叠中不进行cd操作
+n删除从左到右的第n个目录数字从0开始
-n删除从右到左的第n个目录数字从0开始</code></pre>
<h3 id="参数">参数</h3>
<p>目录:需要压入堆栈的目录。</p>
<h3 id="实例">实例</h3>
<pre><code class="language-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</code></pre>
<p>注意:最左边表示栈顶,最右边表示栈底。</p>
<!-- Linux命令行搜索引擎https://jaywcjlove.github.io/linux-command/ -->