>_ linuxcommand.dev
File Operations

rm

Remove files or directories. Deleted data is usually not recoverable.

Syntax
$rm [OPTIONS] FILE...
Optionen
-r, --recursive Delete directories recursively
-f, --force No prompts, ignore non-existent files
-i, --interactive Ask before each deletion
-v, --verbose Show deleted files
--preserve-root Prevents accidental deletion of / (default in newer versions)
--one-file-system Stays in the same filesystem
Examples
Examples
$rm file.txt
Examples
$rm -r folder/
Examples
$rm -rf /tmp/*
Examples
$rm -i important_file.txt
Examples
$rm --preserve-root /
Warnings
DANGER: This command can irreversibly destroy data!
Tip: First test with ls or other read-only commands
Shortcuts
rm -rf / (NEVER run - destroys the system!)
rm -rf * (deletes everything in current directory)
Typical use cases
Delete temporary files
rm -rf /tmp/*
Remove old logs
rm /var/log/*.old
Note One of the most dangerous commands in the Linux arsenal. Always double-check! Alternatives: trash-cli for recoverable deletions, shred for secure deletion of sensitive data.
Export