- 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.