rm

rm (BSD) Cheatsheet #

The rm command is used to remove files or directories in Unix-like operating systems.

Basic Commands #

Command/OptionExampleDescription
rm filerm example.txtRemove a file
rm -r dirrm -r mydirRemove a directory and its contents
rm -f filerm -f example.txtForce remove a file, ignore nonexistent files
rm -i filerm -i example.txtPrompt before every removal
rm -r -i dirrm -r -i mydirPrompt before removing each file in a directory

Advanced Options #

Command/OptionExampleDescription
rm -d dirrm -d emptydirRemove an empty directory
rm -v filerm -v example.txtVerbose mode, show files as they are removed
rm -P filerm -P example.txtOverwrite the file before removing (secure deletion)

This cheatsheet provides key BSD rm options for file and directory removal.

rm

Explore our comprehensive cheatsheets to enhance your knowledge and efficiency. Each cheatsheet provides detailed command options, examples, and descriptions to help you master various tools and technologies.