Lesson 69 lessons

Common Commands: cat, nano, rm — and Why rm Is Dangerous

cat — read a file's contents

cat filename ("concatenate") prints a file's entire text content directly into the terminal — useful for quickly peeking inside a small text file without opening a separate app.

nano — a simple built-in text editor

nano filename opens a basic, beginner-friendly text editor directly inside the terminal, where you can type and edit content. The commands to save and exit are shown at the bottom of the screen (usually Ctrl+O to save, Ctrl+X to exit) — you don't need to memorize a complex editor to make small text edits.

rm — delete, permanently, with no confirmation and no trash bin

rm filename deletes a file immediately and permanently — it does NOT go to a Recycle Bin or Trash you can recover from. rm -rf foldername deletes an entire folder and everything inside it, instantly, with zero confirmation prompt. This is the single most dangerous command in this entire lesson — always double- and triple-check the exact name before pressing Enter on any rm command.

Key Takeaways

  • `cat filename` prints a text file's full contents into the terminal.
  • `nano filename` opens a simple in-terminal text editor for quick edits.
  • `rm filename` deletes permanently — there's no Recycle Bin or Trash to recover from.
  • `rm -rf foldername` deletes an entire folder instantly with zero confirmation — the most dangerous command here.

Practice safely

Create a test file with `echo "hello" > test.txt`, read it with `cat test.txt`, edit it with `nano test.txt` (add a line, save, exit), then delete it with `rm test.txt` — practicing on a file you made specifically to be deleted.