Hello Guys, As you and I always say and we will continue to say. “The command line is power” yes the command line is really power even more.
Today am going to share with you a command line skill of emptying Trash in Ubuntu. I have not tried it on other distros. If it works, good.
Launch Terminal (ctrl + alt + t).
In your home directory from the time. Run the command below:
$ cd /.local/share/Trash
In the Trash directory type the ls command to list its contents.
[email protected]:~/.local/share/Trash$ ls
Now from the image above you can see that there three other directories located in Trash. (Am not sure you ever seen this before. Not even in GUI Trash too)
First of all all these directories perform a special function in the background which GUI Trash doesn’t show you.
Now assuming I have deleted a file or folder it will currently be located in files.
Info gives you summary or list of all the files that have passed through Trash file directory or are currently located there since you logged on.
For the final directory expunged is still in the research. I don’t know what it actually does. If you know kindly share with us and anyone reading this article by commenting its function. Thanks.
Now since we know all that are in Trash now is what we want remove, we can quickly run the command below to remove everything (including all those three directories)
[email protected]:~/.local/share/Trash$ rm -rf *
Also, you can also run a single command to save you the time of changing directories by combining all the above commands:
[email protected]:~$ rm -rf ~/.local/share/Trash/files/*
[email protected]:~$ rm -rf ~/.local/share/Trash/*
But Note: These three directories are system directories so they will always be available anytime you push something to Trash. You can verify by repeating the steps treated earlier after moving something to Trash.