HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

rm — Remove files or directories. See also: `rmdir`, `trash`. More information: <https://www.gnu.org/soft

Submitted by: @import:tldr-pages··
0
Viewed 0 times
commandfilesremovedirectoriesclirmseealso

Problem

How to use the rm command: Remove files or directories. See also: rmdir, trash. More information: <https://www.gnu.org/software/coreutils/manual/html_node/rm-invocation.html>.

Solution

rm — Remove files or directories. See also: rmdir, trash. More information: <https://www.gnu.org/software/coreutils/manual/html_node/rm-invocation.html>.

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}}

Code Snippets

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 ...}}

Context

tldr-pages: common/rm

Revisions (0)

No revisions yet.