Forever & AlwaysLINUX COMMAND ATLAS

LINUX COMMAND ATLAS · COMMAND GUIDE

Linux rm command

Remove files. This does not normally move them to a recoverable trash folder.

GNU Coreutils

Syntax

Command form
rm [OPTION]... FILE...

Common options

6 options
OptionWhat it does
-i, --interactive=alwaysPrompt before every removal.
-IPrompt once before removing many files or recursively.
-f, --forceIgnore nonexistent files and never prompt.
-r, -R, --recursiveRemove directories and their contents recursively.
-d, --dirRemove empty directories.
-v, --verbosePrint each removed item.

Usage examples

3 examples

Remove files. This does not normally move them to a recoverable trash folder.

rm -i ./old-notes.txt

Ask before deleting a file; -- ends option parsing.

rm -i -- old-draft.txt

Ask once before removing multiple matching files.

rm -I -- *.tmp

Notes

Deletion may be irreversible. Check the current directory and exact paths first; never run an unfamiliar recursive command with elevated privileges.