rm - Remove Files in Linux

From the Linux Essential Commands cheat sheet · File & Directory Operations · verified Jul 2026

rm - Remove Files

Delete files and directories (use with caution)

bash
# Remove files
rm file.txt
rm file1.txt file2.txt

# Remove directories
rm -r directory/
rm -rf directory/      # Force remove (no confirmation)

# Remove with confirmation
rm -i file.txt

# Remove empty directory
rmdir empty_dir/
✅ -r (recursive) required for directories
💡 -f forces deletion without prompts (dangerous!)
🔍 Use rm -i to confirm before deleting important files
filesdeleteremovebasic

Continue with Linux Essential Commands

Save the full cheat sheet or work through every related task.

More Linux tasks

Back to the full Linux Essential Commands cheat sheet