How to Delete Files and Directories in Linux (rm)

rm permanently removes files or directories — there is no built-in trash or undo.

Published September 30, 2026

rm permanently removes files or directories — there is no built-in trash or undo.

Key points

  • rm -r is required to delete a directory and everything inside it
  • rm -f suppresses confirmation prompts and errors for files that don't exist — use with caution
  • rm -rf combines both and is one of the most destructive commands in Linux; double-check the path before running it

Example

rm -r ./old-build
More Linux articles