Where to start First steps track · 15 stages
Linux Labs

rm — remove files and directories

cheat sheet · Ubuntu 24.04 · GNU coreutils 9.4 https://lab.dimsanych.ru/en/wiki/rm/

Cheat sheet

  • rm notes.txt delete a file
  • rm -i *.log ask about every file
  • rm -I *.log ask once if there are more than three
  • rm -r old-project a directory with everything inside
  • rm -rf build/ no prompts, no errors about missing files
  • rm -d empty-dir an empty directory (like rmdir)
  • rm -v *.tmp print each removal
  • rm -- -file.txt a name that starts with a dash
  • ls *.log && rm -i *.log look first, then delete

Options

Full list — man rm. In practice -i, -I, -r, -f, -v are enough.

Loading…