50

I tried opening Trash by running the command nautilus, but it gives me an error.

  • 4
    Could you be more specific, which error did you get and which command did you use – Leon palafox Aug 2 '13 at 18:15
  • 1
    Related: Command to move a file to Trash via Terminal – wjandrea Sep 15 '17 at 19:12
  • But running the command nautilus would not by itself open "Trash", would it? Don't you mean "I tried opening Trash by first running the command nautilus and then selecting "Trash""? – Peter Mortensen May 26 '20 at 12:01
  • Alternatively, there is an error message in the command line window, but it doesn't seem to be of consequence, including using "Trash". For Ubuntu 19.10 (Eoan Ermine): "(org.gnome.Nautilus:9057): IBUS-WARNING **: 14:00:39.919: Unable to connect to ibus: Could not connect: Connection refused Nautilus-Share-Message: 14:00:40.036: Called "net usershare info" but it failed: Failed to execute child process “net” (No such file or directory)""* – Peter Mortensen May 26 '20 at 12:13
  • (The error message does not appear when starting Nemo) – Peter Mortensen May 26 '20 at 13:33
71

The trash folder should be located under:

/home/your_username/.local/share/Trash

So you should be able to access it via:

cd ~/.local/share/Trash

The folder might not exist unless you delete something from the filesystem. In this case you would run into an error (saying that the folder does not exist).

25

If you want to open Trash using Nautilus run the following:

nautilus trash://
  • Or if you want to open the default app: "gvfs-open trash://". If Nautilus is your default, it will open the trash. – Jo-Erlend Schinstad Oct 3 '17 at 11:19
10

For Ubuntu 18.04 and newer, use gio. For older versions, use gvfs-ls and gvfs-trash.

To read the trash:

gio list trash://
gvfs-ls trash://

To send files or directories to the trash:

gio trash [FILE or DIR]
gvfs-trash [FILE or DIR]

To empty it:

gio trash --empty
gvfs-trash --empty
  • 2
    man gvfs-trash tells me that it is deprecated in favour of gio trash $FILE; listing trash is done by gio list trash://. – pbhj Sep 1 '18 at 21:13
  • 1
    Thanks! I added that in like a year ago but forgot to mention to you. – wjandrea Nov 19 '19 at 14:59
  • This should be the accepted answer now, gio works for all mount point, which isn't the case of the accepted answer, also gio offers a better cli interface to trash handling – Brice Dec 13 '19 at 13:02
  • 1
    How to restore/recover a file with gio? With trash-clie I can do trash-restore and then select a file to restore! I couldn't find an alternative with gio . see here – Farid Cheraghi Apr 27 '20 at 7:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.