17

For the purpose of this question, "large directory" means for example a Linux kernel git repository, or the Chromium source.

If I rm -rf a large directory like this from the shell, it is deleted in only a couple of seconds at most.

If I move it to trash first and then empty the trash, the first operation takes under a second, then the actual delete takes several minutes (we are talking double figures.)

Why is emptying the trash so slow? What is it doing when it says "preparing." How much preparation does it actually take to run rm -rf ~/.local/share/Trash/?

I've been looking at this for over 20 minutes now.

2
  • If you have some free time you could take a look at libnautilus-private/nautilus-file-operations.c in the source (apt-get source nautilus). I don't have the diligence and patience for reading C. Interesting question though. +1 Mar 9, 2013 at 0:44
  • 3
    rm -rf ~/.local/share/Trash might be faster. See askubuntu.com/a/468722/2273 Nov 10, 2015 at 19:52

1 Answer 1

5

When the first operation occurs it just moves the files to the trash.

When you "trash" those files it loads the entire tree file into memory and then deletes each file one by one. This allows for timing calculations to know how long it takes to delete the file, how many files are to be deleted, how big those files are, although most of the parameters are not used here, and allows you to press that little red cross to stop the process.

Thats why I always delete from the shell

1
  • when I access nautilus trash, it freezes nautilus for a long time that I cant press anything; I wonder if there could have some way to disable it or popup if I really want to see it on nautilus because I use it for many other things and then, suddenly I have to wait like 3 minutes to be able to use nautilus again if I dont want to restart it :( Sep 29, 2014 at 20:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .