🖥️cd

➡️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 cd command with important options and switches using examples.

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

 #                ██████╗██████╗ 
 #               ██╔════╝██╔══██╗
 #               ██║     ██║  ██║
 #               ██║     ██║  ██║
 #               ╚██████╗██████╔╝
 #                ╚═════╝╚═════╝ 
                                
                                
#==============================#
# CMD CD change Directory
#==============================##==============================#
cd .
# If you are in a directory that is removed and recreated (such as a symlinked current dir), this will put you in the new directory.

cd -
# Takes you back to the previous directory you were in. Good to know if you don not already.

cd
# (With no arguments) Takes you back to your home directory.

cd tmp/a/b/c && tar xvf ~/archive.tar
# Use && to run a second command if and only if a first command succeeds

cd /pub ; cd - 
# Change to /pub and then change back to the dir you were in before.

cp !:3 !:2 
# Copy the 3rd word from prev. command over 2nd word of the prev. command. e.g. If prev cmd was diff -Nup older newer then this would run cp newer older. Be careful though. Try it with cp !:3:p !:2 first to see what will happen before executing.

cd $(mktemp -d) 
# get an instant temporary directory

# Access folder "-"
# If you try to access cd - you go to the last folder you were in.
cd -- -

# Access folder "-" -> If you try to access cd - you go to the last folder you were in.
cd -- -

#==============================##==============================#
# CMD CD change Directory
#==============================##==============================#
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

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

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

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

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