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.
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
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?