File and Folder Operations

rm

Removes files or directory trees.

rm deletes directory entries. On normal filesystems this is not a trash operation, so recovery is not guaranteed.

Syntax
rm [options] file...

Arguments explained

  • file is the path to remove.
  • -r removes directories recursively.
  • -i asks before each removal.
  • -f ignores nonexistent files and suppresses prompts.

Common examples

Remove one file
rm old-notes.txt

Deletes the file from the current directory.

Remove a directory carefully
rm -ri old-project

Recursively removes a directory while asking for confirmation.

rm Command
FieldDetails
Commandrm
CategoryFile and Folder Operations
Primary useRemoves files or directory trees.
Syntaxrm [options] file...