Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Yet another method of trashing undeletable files' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Yet another method of trashing undeletable files
Authored by: mschaff on Feb 14, '06 10:21:52AM

Careful with throwing the Unix around. This is a surefire way for a Unix newbie to nuke all of his files. Perhaps before posting Unix commands like that, you comment them first.

To comment your command:
sudo = give full admin permissions to any command that follows
rm = remove file(s)
-fr = force recursively (including directories [a.k.a. folders])

It's the /path/to/folder part that is scary. If you inadvertently hit return after a single slash, your entire hard drive will be erased with no warning.

[ Reply to This | # ]
Pathname safety
Authored by: Rainy Day on Feb 14, '06 12:53:03PM
The safe way to enter fully qualified pathnames is to drag the file/folder icon you wish to delete to a Terminal window. The fully qualified path to that item will be automagically entered into the shell for you.

Ideally, you will have already typed your Unix command before doing that, so all you have to do is hit return, but i usually don't remember to do that beforehand. Fortunately, all you have to do is hit Control-A, which moves your shell cursor to the start of the line, and type the command (with a space at the end) then hit return (cursor can be anywhere on the line, doesn't have to be at the end).

You can also use cut and paste, or drag and drop text in the shell.


[ Reply to This | # ]

Pathname safety
Authored by: ManxStef on Feb 14, '06 01:03:03PM

Personally, if I'm doing an operation deemed "risky" such as rm -rf I always navigate down to the parent directory first, then use a relative path instead of an absolute e.g.

cd /path/to
sudo rm -rf delete

(Using tab-completion for the paths, too.) This is a fair bit safer IMO as you're a lot less likely to kill everything with a relative path than an accidental slash in an absolute.

[ Reply to This | # ]
Pathname safety
Authored by: sjk on Feb 16, '06 03:32:43PM

Good meta-hint!

[ Reply to This | # ]