X

3 Ways to Remove Files from Trash on Ubuntu using GUI and Terminal

By choosing files and documents and hitting the “Remove” key on the keyboard, users can remove all data. Those files are then moved to Junk, a computer location for discarded data. Deleted files remain inside the "Trash" folder unless you elect to clear it or restored the contents. Throughout this article, we'll look at the first choice: how and where to delete documents via Trash.

Method 01: Using File Manager to empty Trash on Ubuntu

This approach will be performed through the user interface, therefore those who aren't used to utilizing the console might go with this one. Use the sidebar to access Ubuntu's file manager. A collection of available folders may be seen from the left side. Double-click on the icon of “Trash” from the desktop of Ubuntu.

It will directly open the File Manager “Trash” folder of your Ubuntu System. You can see we have a deb file in our Trash folder. So, we will be deleting this file. The first way is used to delete all the files and folders from the “Trash” using the “Empty” button highlighted at the top right corner of the Trash folder window.

A dialogue box will be appeared as below showing a warning. It is asking you if you want to delete all the data from the Trash or not? If one wants to empty the Trash folder then they can simply hit it off on the button of “Empty Trash”. Otherwise, tap the Cancel button. This will delete all the files from the Trash folder.

Try to ensure that there were no essential files on your computer before continuing. To delete a file click on it. You will see that the Restore button will also be highlighted during this. Whether there are any important files, use the “Restore” button. If not, hit the “Trash” button. Another way is by right-clicking on the file first. You can choose any one option you want to do. You can also restore the file and delete it permanently. Hence, tap on the option of “Delete from Trash”.

A dialogue given below will be opened making sure that you want to delete a particular file. Hit the “Delete” button to carry on.

Method 02: Using Command-Line to empty Trash on Ubuntu

Using the “Ctrl+Alt+T” shortcut way, you need to launch the console application in your Ubuntu system. Now the terminal is opened, we have to first move towards the “Trash” folder held in our system through it. So, we need the “cd” command with the path to be followed in it. As you can see, we have used the below “Cd” query to get throughout the “Trash” folder.

$ cd ./local/share/Trash

Now travel en route for the “files” directory via “cd” instruction as follows:

$ cd files

Now, we can list the contents and files of this folder by simply utilizing the “ls” query. We have only one file in this folder yet.

$ ls

To remove all the files from the trash folder, try out the below “rm” command as below.

$ rm –rf *

Now when you list the contents of this folder, you will find the folder empty.

$ ls

Method 03: Using Trash-cli to remove files from Trash on Ubuntu

In this method, we need to first install the “trash-cli” package via terminal in our system. Hence, we have used the apt package command to do so with sudo rights. Add your sudo password to continue this processing.

$ sudo apt install trash-cli

For continuing the process of trash-cli, tap “y” and smash the “Enter” button.

Wait for a little until it finishes its installation.

Now the installation procedure is finished, we can go forward.

Using the below command we can empty the trash from the trash folder.

$ trash-empty

Conclusion

We have presented three viable techniques for clearing your trash on Ubuntu in this post. Hopefully, these approaches will be beneficial to you and helped you complete your task!

Karim Buzdar: About the Author: Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various websites.
X

Headline

You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:

Privacy Settings