Custom Search

Ubuntu cannot delete files from trash

This Ubuntu tips are for Ubuntu server with x-window installed, Ubuntu desktop and perhaps other Linux distributions as well.

I have seen this problem a few times in my FTP server. When I try to clear the trash from x-window, Ubuntu cannot delete the files from trash. I know that must be permission problem. I normally log in to my server using normal user, especially x-window.

So what I did was, I restored the file that cannot be deleted. As I said earlier, it was a file from my ftp server. I open a terminal in x-window and change directory to ftp directory. Long listing the directory content to see the file's permission and ownership (then smile). That's not necessary, just a habit and satisfaction for me. Then switch to root and delete the file. Don't ask me why I chose the way I did just to delete files from trash. Sometimes I did what I did just to have fun using Ubuntu commands.

The normal method most users would do if Ubuntu cannot delete files from trash is change to trash directory and use sudo command for root privilege to delete the file.

luzar@ubuntu:~$ cd
luzar@ubuntu:~$ pwd
/home/luzar
luzar@ubuntu:~$ cd .local/share/Trash/
luzar@ubuntu:~/.local/share/Trash$
luzar@ubuntu:~/.local/share/Trash$ sudo rm -r

Use rm -rf instead if you have many files in the folder. If you need help with delete files in Ubuntu, check my previous post, Ubuntu delete file. Note for Ubuntu user with gnome, the trash directory is in the /home/username/.Trash.

1 comment:

  1. Thank you! It works well but the correct command is:

    luzar@ubuntu:~$ cd .local/share/Trash/files
    $ sudo rm -r

    ReplyDelete

Please keep comment relevant and strictly no spam will be tolerated. Thank you.