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

Empty the trash via the command line UNIX
Opera was crashing on me constantly, so I decided to trash my Opera preferences. Little did I know (until I was emptying the trash) that my Opera prefs folder contained 38,000 items! After waiting for about 10 minutes, I still had 35,000 items left to empty. I decided to bail out and do it from the command line, where it took approximately 15 seconds! A simple rm -r * to empty my .Trash folder did the trick.

[Editor's note: If you're new to the terminal, be very careful with the 'rm' command. There is no going back, and there's no confirmation (by default). To do this safely, you should first type cd ~/.Trash (to make sure you're in your trash directory) and you may want to use rm -ri * which will ask for confirmation on each file. Although this won't be fast, you'll be confident you're deleting the right files before they're all gone! A wise friend once said to me that there are two types of UNIX users ... those that have "rm -r *"ed the wrong directory, and those that will...]
    •    
  • Currently 2.60 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (5 votes cast)
 
[22,985 views]  

Empty the trash via the command line | 3 comments | Create New Account
Click here to return to the 'Empty the trash via the command line' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
trash via rm..
Authored by: bhines on Aug 14, '01 05:19:37PM

Hmm.. not sure if this is a good idea. MacOS may do other stuff when it empties the trash, like get rid of the desktop file entries, which rm will not do.

-Ben



[ Reply to This | # ]
trash via rm..
Authored by: Anonymous on Sep 02, '01 11:47:21PM

You know, rm works just fine for pretty much every other file it deletes. Why should the trash be any different? =D



[ Reply to This | # ]
Those who have and those who will...
Authored by: Anonymous on Sep 02, '01 11:49:45PM

I'd like to add a second part to that rule:

There are two kinds of Mac users. Those who have done Erase Disk... on the wrong volume, and those who will. I speak from personal experience here folks. Thank god we back up regularly!



[ Reply to This | # ]