Deleting Files and Directories with rm

The rm command has only one parameter of interest: —preserve-root. By now, you should know that issuing rm -rf / with sudo destroys your Linux installation because -r means recursive and -f means force (do not prompt for confirmation before deleting). It is possible for a clumsy person to issue this command by accident—not by typing the command on purpose, but by putting a space in the wrong place. For example:

matthew@seymour:~$ rm -rf /home/matthew

That command deletes the /home directory of the user matthew. This is not an uncommon command; after you have removed a user and backed up the user’s data, you will probably want to issue something similar. However, if you add an ...

Get Ubuntu Unleashed 2014 Edition: Covering 13.10 and 14.04,Ninth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.