Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

On a Mac computer, when you write

 rm -rf ~/.Trash/*

in the terminal, it almost instantly deletes all the files in the Trash.

But when I click "empty trash", it takes forever to delete them all.

share|improve this question
    
Have you set securely empty trash or an equivalent feature on? If so, the command is as Claudio says which the GUI could be doing a hook that does a zero-out pass. –  nerdwaller Mar 7 '13 at 3:32
    
How long is forever? How many files do you have? It could just be that the GUI is stuttering on updating the UI if you have tons of small files. If naively implemented, the UI could remove one icon per file deleted from the filesystem, which is slow. –  tjameson Mar 7 '13 at 5:46

1 Answer 1

When you use rm -rf ~/.Trash/* you're directly using a system call that unlinks these files from the filesystem, freeing the space allocated by them. If you use a GUI tool instead (I suppose you are referring to it when you say "click empty trash") it is probably saving or moving these files somewhere else so you can possibly undelete them, which is not directly possible using the shell command line. That should be the reason it is faster, but it wouldn't explain the GUI tool taking "forever".

How many times faster do you perceive the command line erase comparing to the GUI tool?

share|improve this answer
    
The command line would be less than 5 seconds. Compare that to the GUI tool, which would take sometimes 3-5 minutes to empty everything. This is for about 1.5GB of files. –  averageUsername123 Mar 10 '13 at 2:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.