rm

Description

Remove files or directories.

Syntax

rm [OPTION]... [FILE]...

Practical uses

  • rm -f: Ignore nonexistent files and arguments, never prompt.
  • rm -i: Prompt before every removal.
  • rm -I (capital i): Prompt once before removing more than three files, or when removing recursively; less intrusive than -i, while still giving protection against most mistakes.
  • rm -r and rm -R: Remove directories and their contents recursively.

Get Learn Linux Shell Scripting - Fundamentals of Bash 4.4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.