$ rm
Remove files or directories
DOCUMENTEDFiles & directoriesUbuntu 24.04 LTS baseline
Use care. This command removes directory entries. With recursive options it can remove directory trees and their contents. Verify the path before executing it, especially as root.
Synopsis
rm [OPTION]... FILE...
What it does
- `rm` removes directory entries and therefore can make data inaccessible through that pathname.
- `rm -r` recursively removes directories and their contents; use it carefully.
Examples
Remove a file
rm old.txtRemove a directory tree
rm -r old-project/Prompt before each removal
rm -i file.txtImportant details
These examples are intentionally conservative. Command behavior can still depend on filesystem state, permissions, locale, shell, installed package version, and other system configuration.
For exact option semantics, the linked authoritative documentation is the source of truth.