commands.sh
⌘K

rm

all

Remove files or directories. See also: `rmdir`, `trash`.

More info →

Options (5)

-f, --forceboolean

Remove specific files ignoring nonexistent ones

Example: rm {{[-f|--force]}} {{path/to/file1 path/to/file2 ...}}
-i, --interactiveboolean

Remove specific files interactively prompting before each removal

Example: rm {{[-i|--interactive]}} {{path/to/file1 path/to/file2 ...}}
-v, --verboseboolean

Remove specific files printing info about each removal

Example: rm {{[-v|--verbose]}} {{path/to/file1 path/to/file2 ...}}
-r, --recursiveboolean

Remove specific files and directories recursively

Example: rm {{[-r|--recursive]}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}
-d, --dirboolean

Remove empty directories (this is considered the safe method)

Example: rm {{[-d|--dir]}} {{path/to/directory}}

Examples (6)

Remove specific files

rm path/to/file1 path/to/file2 ...

Remove specific files ignoring nonexistent ones

rm [-f|--force] path/to/file1 path/to/file2 ...

Remove specific files interactively prompting before each removal

rm [-i|--interactive] path/to/file1 path/to/file2 ...

Remove specific files printing info about each removal

rm [-v|--verbose] path/to/file1 path/to/file2 ...

Remove specific files and directories recursively

rm [-r|--recursive] path/to/file_or_directory1 path/to/file_or_directory2 ...

Remove empty directories (this is considered the safe method)

rm [-d|--dir] path/to/directory
made by @shridhargupta | data from tldr-pages