0


How to delete trash from command line Ubuntu



In ubuntu, if you delete files or folders from the GUI, the deleted files/folders will go to trash can, you can delete the trash can content by right click and then choose 'empty trash'. The question is how to do it from command line?

How to delete files and folders in the trash can from command line? how to empty trash can from the command line? is it possible? of course it's possible.

The first thing we need to know is the location of the trash can, the trash can is actually a hidden folder located at ~/.local/share/Trash/.


~/.local/share/Trash

Open terminal/ console/ command line mode on your ubuntu and then go to the location of trash can, use cd command (change directory) to go there.


cd ~/.local/share/Trash

Once you are on that folder, run ls command to show list of files/ folders inside it. There should be three folder; expunged, files, info.


ls ~/.local/share/Trash/files/

kernelpanic@kernelpanic:~$ ls ~/.local/share/Trash/
expunged files info


The deleted files and folder located inside folder called 'files', go ahead delete a file and then take a look on that folder, you should see the deleted file.


ls ~/.local/share/Trash/files/

To delete the file on trash can, you can use the regular command for deleting files which is the rm command, and if you want to delete folder just add -R parameter.


cd ~/.local/share/Trash/files/

rm my_picture.jpg

rm -R my_folder

Take a look at this video for more detail

If You Like This Please Leave a Comment Or Share this Post

Full Softwares Android Apps

Download From Revcloud | Mirror | Mirror



How to delete trash from command line Ubuntu


Posting Komentar

 
Top