2023-01-08 01:31:17 +10:00
|
|
|
# rm
|
|
|
|
|
|
|
|
> Remove files or directories.
|
|
|
|
> See also: `rmdir`.
|
2025-01-18 18:45:33 +05:30
|
|
|
> More information: <https://www.gnu.org/software/coreutils/manual/html_node/rm-invocation.html>.
|
2023-01-08 01:31:17 +10:00
|
|
|
|
|
|
|
- Remove specific files:
|
|
|
|
|
|
|
|
`rm {{path/to/file1 path/to/file2 ...}}`
|
|
|
|
|
|
|
|
- Remove specific files ignoring nonexistent ones:
|
|
|
|
|
2025-03-07 13:45:30 +02:00
|
|
|
`rm {{[-f|--force]}} {{path/to/file1 path/to/file2 ...}}`
|
2023-01-08 01:31:17 +10:00
|
|
|
|
|
|
|
- Remove specific files interactively prompting before each removal:
|
|
|
|
|
2025-03-07 13:45:30 +02:00
|
|
|
`rm {{[-i|--interactive]}} {{path/to/file1 path/to/file2 ...}}`
|
2023-01-08 01:31:17 +10:00
|
|
|
|
|
|
|
- Remove specific files printing info about each removal:
|
|
|
|
|
2025-03-07 13:45:30 +02:00
|
|
|
`rm {{[-v|--verbose]}} {{path/to/file1 path/to/file2 ...}}`
|
2023-01-08 01:31:17 +10:00
|
|
|
|
|
|
|
- Remove specific files and directories recursively:
|
|
|
|
|
2025-03-07 13:45:30 +02:00
|
|
|
`rm {{[-r|--recursive]}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
|
2024-09-04 19:08:41 +03:00
|
|
|
|
|
|
|
- Remove empty directories (this is considered the safe method):
|
|
|
|
|
2025-03-07 13:45:30 +02:00
|
|
|
`rm {{[-d|--dir]}} {{path/to/directory}}`
|