rm

Linux · Files · available in the simulator

What it does

Remove files or directories (including non-empty ones with -R).

Syntax

rm [opciones] archivo...

Options and parameters

  • -R

    Remove directories and their contents recursively.

  • -i

    Prompt before every removal.

  • -f

    Ignore nonexistent files and arguments, never prompt.

    rm -rf carpeta
  • -v

    Explain what is being done (display each removed file).

  • -r

    Remove directories and their contents recursively.

    rm -r carpeta
  • -I

    Prompt once before removing more than three files.

  • -d

    Remove empty directories.

  • --preserve-root

    Do not remove '/' recursively; enabled by default.

Usage examples

  • rm error
  • rm -R linux
  • rm -i *.txt
  • rm archivo.txt
  • rm -rf build/
  • rm -r carpeta
  • rm -rf carpeta

Notes and common mistakes

  • rm -rf does not use a trash bin: on a real system, deletion is permanent.
Practise rm

Related commands