Currently Being Moderated

kmosx2: When to use sudo rm -rf?

Disclaimer: Apple does not necessarily endorse any suggestions, solutions, or third-party software products that may be mentioned in the topic below. Apple encourages you to first seek a solution at Apple Support. The following links are provided as is, with no guarantee of the effectiveness or reliability of the information. Apple does not guarantee that these links will be maintained or functional at any given time. Use the information below at your own discretion.


NEVER EVER used sudo rm -rf.

One slight typo will cause your hard drive be completely wiped clean.

One solitary typo.

If you are going to use sudo rm use the -i tag and not the -f tag.

i.e.

sudo rm -ri followed by what you want to delete


Yes it takes more time, yes it means having to answer 'y' to each file you want to delete. But if your the "followed by what you want to delete" is a typo, you'll have a chance to correct yourself. Ctrl key + C key to cancel out of the deletion process if it starts asking you to delete files you don't want to delete.

If it tells you such and such is a directory, make note of the directory name and cd into it later on by typing

cd name

where name is the name of the directory, and then if you want to delete that directory's contents rm -ri again

But never ever use sudo rm -rf
It is dangerous as having a machine that renders everything invisible with a single shot.

If anyone tells you anything to the contrary, don't follow their advice regarding sudo rm.

Do you want to provide feedback on this User Contributed Tip or contribute your own? If you have achieved Level 2 status, visit the User Tips Library Contributions forum for more information.

Replies

  • 0 Replies:

Delete User Tip

Are you sure you want to delete this user tip?