# Cannot remove file from trash that was put there as root

I know about the dangers of using root access so please forego the lectures. I try to be careful and will be doubly so from now on.

I was using the file browser with root access in order to change some file permissions. During the process I deleted some files (I should say that I out them in the trash). Little did I know that the files would go to the trash as root and now I can't remove them because I don't have the permission to read them but I don't know how to access them to change the permissions because I don't know how to get into the trash as root. All I get is a message saying that:

This location could not be displayed.

Sorry, could not display all the contents of trash:///: Operation not supported

I have searched around to try to find posts about it but I've only found outdated information about a hidden file in the root directory. That doesn't seem to apply any more so I'm stuck with a file in my trash that I can't remove and can't gain access to.

I'm using Ubuntu 14.04 64bit on an ASUS x401a laptop.

• what about you relaunch nautilus as root and empty the trash ? Otherwise, you should be able to access your trash folder through terminal via sudo cd /home/your_username/.local/share/Trash – Aserre Aug 5 '14 at 14:40
• we do not use "solved" in titles here, instead, hit the green check mark on the answer that worked for you. – Mateo Aug 11 '14 at 22:05
• In this case the answer was in the comment from Ploutox. I can't seem to mark it. What can I do? – jeop Aug 14 '14 at 13:26
• @jeop when someone, especially someone with enough rep to know better, comments instead of answers, i paste it myself as an answer. you can always make it community wiki if you don't want the rep from it. see meta.askubuntu.com/questions/6706/convert-comment-as-answer – djeikyb Oct 10 '14 at 5:51

You will need root access to the trash to be able to delete these files - the easiest way to do this in a temporary sense, is to open a terminal window alt+ctrl+t, and enter the command

gksudo nautilus /home/your_username/.local/share/Trash

This will execute the file manager with super-user permissions and you should be able to empty the trash from here. Delete the root-owned file.

When you are done, remember to close the program!

• Thank you for your response but I've tried that and all I get is the message I stated above: "This location could not be displayed. Sorry, could not display all the contents of "trash:///": Operation not supported." – jeop Aug 11 '14 at 21:56
• K - then you might try using sudo as an interactive shell - type sudo -i, then start nautilus from the command line... – Charles Green Aug 12 '14 at 1:43

If you would like to delete all of the contents of the trash you could use sudo and remove the entire directory. Remember to remake the directory so it doesn't cause any problems. The code is:

sudo rm -rf /home/User_Name/.local/share/Trash && mkdir /home/User_Name/.local/share/Trash


That will do it all with one entry into the terminal.

I personally use trash-cli a lot. I use it as an alternative to rm to be safe (e.g. trash -r my-folder).

sudo apt install trash-cli


Once installed you can do

sudo trash-empty


sudo rm -rf ~/.local/share/Trash/*

• You should explain, what this does exactly - and maybe change the command to not delete everything in trash. – guntbert Mar 7 '15 at 12:56

# Use the terminal!1eleven (drag and drop)

• Open a terminal with Ctrl+Alt+t.
• To take ownership of the files again and continue in your filemanager, type the command sudo chown -R $USER:$USER and make sure there is a space at the end.
• Now drag the the affected file or folder from your filemanager to the terminal.

• The result should look like this:

sudo chown -R $USER:$USER '/home/$USER/.local/share/Trash/files/some_file.txt'  or this: sudo chown -R$USER:$USER '/media/$USER/path to external drive/.Trash-1000/files/sömё fïle thät may have fancy encodings, ſpaces & stu𝖋f.txt'


where $USER stands for your user name in the path name. • Run the command by pressing Enter and probably refresh the view with F5 in the filemanager. • As noted by David Foerster, you can replace the apostrophes with quotation marks, to have shell variable expansion. Using the terminal with files isn't that difficult when drag and drop works, is it? ^^ It is a very handy feature when you know how to use it. Alternatively you can delete single files with rm. Deleting folders can be done with rmdir for empty folders or rm -r for deleting files and folders recursively. While the drag and drop method should work in almost all cases and properly escape everything you should still be careful when using deletion commands. Owning the files and deleting them in your filemanager is the safer solution. # Related • @DavidFoerster Your edit was generally right, but the apostrophes are automatically generated by dragging the file into the terminal. Replacing them in the examples will cause confusion. – LiveWireBT Mar 7 '15 at 14:41 • I'll suggest another edit, that explains the meaning of $USER then, because it won't appear like that on the terminal either. – David Foerster Mar 7 '15 at 15:55

If you have midnight commander installed you can open it using sudo:

sudo mc


go to:

~/.local/share/Trash/


and use alt + F6 to delete the files you want.