🖥️pushd

➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the pushd command with important options and switches using examples.

▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁

#                ██████╗ ██╗   ██╗███████╗██╗  ██╗██████╗ 
#                ██╔══██╗██║   ██║██╔════╝██║  ██║██╔══██╗
#                ██████╔╝██║   ██║███████╗███████║██║  ██║
#                ██╔═══╝ ██║   ██║╚════██║██╔══██║██║  ██║
#                ██║     ╚██████╔╝███████║██║  ██║██████╔╝
#                ╚═╝      ╚═════╝ ╚══════╝╚═╝  ╚═╝╚═════╝ 
                                                         
                

# Pushes your current directory to the top of a stack while changing to the specified directory
pushd <directory>

pushd and popd 
# are also common programs you can use for moving around the filesystem. See 'help pushd' and 'help popd' for info.

# To return use popd
popd

# Come back quickly to the current directory after doing some temporary work somewhere else
pushd /some/where/else; work; cd /somewhere; work; cd /another/place; popd

# Explanation: 
    # pushd, popd and dirs are bash builtins, you can read about them with help dirs
    # bash keeps a stack of "remembered" directories, and this stack can be manipulated with the pushd and popd builtins, and displayed with the dirs builtin
    # pushd will put the current directory on top of the directory stack. So, if you need to change to a different directory temporarily and you know that eventually you will want to come back to where you are, it is better to change directory with pushd instead of cd. While working on the temporary task you can change directories with cd several times, and in the end when you want to come back to where you started from, you can simply do popd.

#==============================##==============================#
# CMD PUSHD					       #
#==============================##==============================#
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  █║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌

              ██╗ ██╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗
             ████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
             ╚██╔═██╔╝██║  ██║██║   ██║ ╚███╔╝ █████╗  ██║  ██║
             ████████╗██║  ██║██║   ██║ ██╔██╗ ██╔══╝  ██║  ██║
             ╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
              ╚═╝ ╚═╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝

               █║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░