To delete files you can use the command rm
(remove) or folders, rm -r
(remove recursively).
The remove recursively option is a special use of the regular remove command, it will remove
recursively all the files and folders inside the directory before removing the directory itself.
Be very careful when removing files and directories (especially with the -r
) option, as there is NO undo button.
1 – Click to do exercise in a controlled environment before practicing quiz:
Activity to do before quiz: LinuxSurvival (2 sessions about remove file and directory)
2 – Practicing a bit more in your own computer:
Open replit, CHECK your current path, delete the backup of your favourite recipe. Then delete the backup folder entirely (NOTE: your working directory needs to be a parent folder of the file you want to delete).
BE CAREFUL!! THERE IS NO UNDO MAGICAL COMMAND!
We are almost done!
.
We are about to finish, but I want you to go back to the image above and pay some attention to the colors after we list items in the directory!
You’ll see directories as blue items and files as white items. These are the automatic colors in my terminal. Some, but not all, systems will differentiate items by color, trying to help you to recognize them.
Now you are ready!
Try to practice a bit more before your next course!
It will be of great help to a smooth start!