How to recover a file which was removed in nautilus when running as root?
I'm new with Ubuntu and used the command sudo -s
to become root and executed nautilus
to open my Nautilus Elementary as root.
While managing my files, I wrongly pressed the "Delete" button on my important folder.
I thought that folder will going to Trash folder, but if I click on Trash (in nautilus running as root) my nautilus was immediately closed, with the below error in a terminal:
** (nautilus:30221): CRITICAL **: nautilus_file_get_location: assertion `NAUTILUS_IS_FILE (file)' failed
(nautilus:30221): GLib-GIO-CRITICAL **: g_file_get_uri: assertion `G_IS_FILE (file)' failed ** ERROR:nautilus-window-manage-views.c:819:begin_location_change: assertion failed: (location != NULL)
On other user accounts, the trash folder seems to be in .Trash
, but but in /root
, there is no such directory.
Where is my folder that I deleted?
Solution 1:
open nautilus as root:gksu nautilus
then, after entering your password, you will have the nautilus windows.
press Ctrl+H to show the hidden files
then go to /home/.trash-0
all your deteted files during your root session should be there.
Solution 2:
.Trash
is a hidden folder. If you cannot find it, try to open /root/.Trash
manually. In a terminal, you can get a directory listing of it by running:
sudo ls -lA /root/.Trash
Never run as root unless you're sure what you're doing.
Solution 3:
At least in Ubuntu 13.04 and above (not sure exactly when the switch was made), any files deleted in nautilus when running as root can instead be found in:
/root/.local/share/Trash
The actual files will be in a files
directory, while some extra data (which stores information such as when the data was deleted and its original location) can be found in the info
directory.