Get the App
SLTechnology News&Howtos  ›  Servers  › 

Use the popd command of linux to delete records from the shell directory stack

Shulou Source: shulou.com Published: 2022-06-02 15:24:16 10月30日 Update

This article will explain in detail about the use of linux's popd command to delete records from the shell directory stack. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

Used to delete records from the Shell directory stack, if no option is added, the popd command first deletes the record at the top of the Shell directory stack, and then changes the current directory to the directory at the top of the new Shell directory stack.

Syntax format: popd [parameters]

Common parameters:

-n delete the nth directory from the right (n count from 0) + n delete the nth directory from the left (n count from 0)

Reference example

Displays the contents of the Shell directory stack, one per line:

[root@linuxcool] # dirs-v0 / sbin1 / etc2 / var/log

Remove / sbin from the shell directory stack:

[root@linuxcool ~] # popd/etc / var/log

Show the current working directory:

[root@linuxcool ~] # pwdetc

Remove the top stack directory from the directory stack:

[root@linuxcool ~] # popd/var/log

Remove the second directory from the right from the directory stack:

[root@linuxcool ~] # popd-2 this is how to use the popd command of linux to delete records from the shell directory stack. I hope the above can be helpful and learn more. If you think the article is good, you can share it for more people to see.

Tags: Directories stacks commands contents parameters more articles references good practical examples commonly used articles stacks formats knowledge grammar switching work help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Redmi Docker MySQL Microsoft