terminal.cab
No.
11
Date
Learning goal
Terminal Start, lesson 7
Level
1 of 3

Command of the day No. 11: ls first, then rm -i

Purpose: Look first, then delete with a safety question.

Syntax: ls file, then rm -i file

Example:

ls Downloads
manual.pdf  photo.jpg  setup.sh
rm -i Downloads/setup.sh
rm: remove regular file 'Downloads/setup.sh'? y
ls Downloads
manual.pdf  photo.jpg

Output from the simulator, as on a real Linux.

Options:

sudo: If rm refuses, do not just add sudo: the refusal often protects you.

Try it in the terminal Share image

Fills in the command. Nothing runs until you press Enter. After the list, type rm -i Downloads/setup.sh. rm asks first: y deletes, n keeps the file.

Command of the day No. 11: ls first, then rm -i. Purpose: Look first, then delete with a safety question. Example: ls Downloads; rm -i Downloads/setup.sh; ls Downloads. Caution: There is no trash can: what rm deletes is gone for good. Check first: ls with exactly the same names shows what rm would hit. Remember: Same names for ls and rm: look first, then delete.
The same card as an image, 1080 x 1350 pixels.

Today's card ยท All cards so far