0

I am with Linux Mint, I delete a file with caja, it is the file manager for Mate Desktop. Because caja is open as root, now the file which I delete is on the root Trash...

I try as David Yockey to say,

enter image description here

The First I to try to look is the File which delete rescuee.img but to say , Das Argument ist ungültig - Argument is invalid and keine Berechtigung - Not authority..

With the seconds, junk_file, I to come similar...

My question, how can restore this file?

can someone help me, thanks!

2
  • The invalid argument listings correspond to find trying to search particular directories that it can't access. It looks like it found rescuee.img in the directory /media/.../cff201e8-c3bc-4517-95d9-862c547f26f2/.Trash-0/files/. It's not in that directory, is it? Commented Nov 10, 2019 at 16:02
  • yes, now to try again the file to rescue and it belongs to them...
    – dsaj34v
    Commented Nov 10, 2019 at 16:12

3 Answers 3

1

Take a look in /root/.local/share/Trash/files. I ran Caja as root, created a file in /root, deleted it, poked around a bit, and found it in that folder. I was then able to cut & paste it from there back into /root.

4
  • Thanks for you answer!, on my folder share I have not a Trash folder..
    – dsaj34v
    Commented Nov 10, 2019 at 14:28
  • I'd try a bit of detective work, then... In Caja running as root, create a file with a unique name like junk_file and then delete it. Then, log into a root terminal, run find / -name junk_file, and see where it landed. If it's found, you can get it back from there (you should be able to view that location in Caja as well). If not, I'd conclude that your Caja, at least when running as root, is immediately deleting files rather than moving them to a trash directory. Commented Nov 10, 2019 at 14:42
  • Thanks, now I will new Edit my question...
    – dsaj34v
    Commented Nov 10, 2019 at 15:00
  • Because Now rescue again my file with ddrescue, not to need my old file. I wish your a nice Day!
    – dsaj34v
    Commented Nov 10, 2019 at 17:42
1

I don't find this accepted answer entirely satisfactory: files or directories which are sent to Trash have their original location somehow recorded with them so that it is possible to restore them without necessarily knowing that original location.

As a non-root user you can usually use your file explorer, Nemo in my case (OS Linux Mint 18.3), to restore, by clicking Trash and then finding the restore command in the context menu (right-click) of the file in question.

When you run Nemo as root (gksudo nemo) however, this doesn't work: the Trash bounces your focus away, giving you a "no access" message, and doesn't display its contents properly.

But there is a solution which I found: install the trash-cli package.

One of the commands there is restore-trash, incidentally wrongly documented as trash-restore(1) in the man trash page under "SEE ALSO". Going, instead,

man 1 restore-trash 

shows you how this command works: you choose a number from the listed files. You don't need to know the restore location.

Without the trash-cli package I have no idea whether this is possible.

3
  • Very thanks for your answer!, as I to say, I rescue it with ddrecue, but I'll save your answer on my computer as firs aid when next time does the same mistake ...
    – dsaj34v
    Commented Jan 20, 2020 at 9:46
  • 1
    Umm... I think you'll find that ddrescue does NOT supply the original location where the file was when it was sent to trash. So my answer is the normal way to restore. ddrescue would be the "first aid", or rather the "last resort". Commented Jan 20, 2020 at 10:21
  • yes, you have the right, therefore next time that I to delete a file on caja, I'll use your recommendations...
    – dsaj34v
    Commented Jan 20, 2020 at 10:32
1

To restore a deleted file from trash just follow these steps:

  1. install trash-cli package
  2. Just head over to the directory from where you deleted the file
  3. Run command trash-restore, it will give you the list of deleted items from the current folder .now choose the index no of the deleted file you want to restore and you are all done.

Just head over to the directory from where you deleted the file

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .