🖥️rm

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

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

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

                                   
# Remove files and subdirs
rm -rf path/to/the/target/

# Ignore non existent files
rm -f path/to/the/target

# Remove a file with his inode
find /tmp/ -inum 6666 -exec rm -i '{}' \;

#==============================#
# CMD RM - remove
#==============================##==============================#
rm -frv somestuff 2>&1 | tee remove.log 
# When you want to see the output (including stderr) of your removal AND save it.

rm ./-file-starting-with-dash
# another way to handle files starting with a - in CWD is to prefix them with ./

rm "$( ls -1dt /netdumps/*.pcap | tail -1 )"
# Remove the oldest .pcap file in the /netdumps directory.

rm -rf "${MEETINGS[@]}"
# Remove meetings, really fast. (But make sure they are properly quoted)

rm -i
# Delete files, asking for confirmation

rm -frv somestuff 2>&1 | tee remove.log 
# When you want to see the output (including stderr) of your removal AND save it.

rm ./-file-starting-with-dash
# another way to handle files starting with a - in CWD is to prefix them with ./

rm ./- 
# Or rm -- - when you need to remove a file named - after you attempted to see if a program could write to STDOUT (It couldn't)

# To remove a directory that contains other files or directories
rm -r mydir

# do not receive a prompt for each file being removed
rm -rf mydir

#==============================##==============================#
# CMD RM						       #
#==============================##==============================#
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

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

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

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

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