Empty Ubuntu Gnome Trash from the Command Line

Sponsored Link
Ubuntu has a trash can/recycle bin feature similar to windows. The difference with Ubuntu is that you can empty the trash from the command line.

First you need to open your terminal and type the following command

rm -rf ~/.Trash/*

You may also like...

67 Responses

  1. mordreas says:

    worked like a charm, perfect ^^

  2. bob says:

    you can empty a windows trash can from commandline too 😛

  3. Neel says:

    I have a file named 810_98ME2KXP_v1.6 in my trash can and when I empty the trash can this file doesn’t get deleted neither it gets restored. It just stays as it is with the same error all the time

  4. Carl says:

    Trolling us here? Windows 98, Windows ME, Windows 2K, Windows XP xD

  5. Chicken Wing says:

    Thanks! I had tons of files in there

  6. frakbuntu says:

    xbmcbuntu eden

    gksudo nautilus

    right click trash, empty

    “not permission”

    ——- another time

    gksudo nautilus

    right click trash

    empty greyed out

    created a text file in /home of root from nautilus. moved to trash. click on trash to see it in trash, but nooooo

    The folder contents coulid not be displaed.

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

    I have 3 gigs free disk space. The trash is holding me hostage like a union: it does not work as desired, it impairs functionality, and apparently cannot be removed easily. How can I remove the union gremlins (assassinations, torture, genocide…it’s all on the table NOW) AND empty the trash as the above command doesn’t work either!?!?!

    $ ls -al ~/.Trash

    total 8
    drwxrwxr-x 2 frakunions frakunions 48 2012-08-17 00:51 .
    drwx—— 45 frakunions frakunions 1742 2012-08-30 21:09 ..

    [xbmcbuntu eden is so foobared up I’m going to DBAN the drives, install Mint 13, then xbmc]

  7. ECJB says:

    I found the trash in ~/.local/share/Trash.

    $ cd ~/.local/share/Trash
    $ sudo rm -rf expunged/*
    $ sudo rm -rf files/*
    $ sudo rm -rf info/*

    Open the trash again and press F5 – it should now be empty.

    I used sudo because you can empty items into the trash you don’t normally have permission to delete. Nautilus will ask you to authenticate, and then the items will move into the trash. However, once there, you can’t empty them from the trash.

    Truing to run nautilus using sudo doesn’t work to empty the trash. For some reason, nautilus doesn’t recognize trash:///, computer:///, or any similar virtual directory when run using sudo.

    If there are multiple users, you may need to empty those manually as well.

    $ for f in /home/*; do t="$f/.local/share/Trash"; if [ -d "$t" ] ; then for g in expunged info files; do sudo rm -rf "$t/$g"; done; fi; done

Leave a Reply

Your email address will not be published. Required fields are marked *