Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I saved a text file in gedit last night before shutting off my computer, and I remember what I named the file. When I turned on my computer this morning to load the file, I could not find it. I've searched for the file, and I've searched its content usinggrep, and I still have not found the file.

When I open gedit, in the "file" drop-down menu it lists my most recent files, and the filename of the missing file is there, however, when I select it, there is no text, it is empty. It says it is located in /tmp but I cannot find the file when I browse or search the filesystem. Please help me

share|improve this question

4 Answers 4

up vote 4 down vote accepted

According to the message in gedit you saved the file in the /tmp folder. Ubuntu as well as many other Linux distributions deletes all content in /tmp on every reboot. This is a recommendation from the Filesystem Hierarchy Standard.

Sad to say if you don't have another backup copy, your original is lost.

If you want to keep the files in /tmp longer, this answer describes how to set the value of TMPTIME.

share|improve this answer
3  
I have no idea how or why I saved it in /tmp, but I guess it's gone now. I'll just have to be more careful about where I save my files. –  Antonia Feb 24 '13 at 23:20
    
It happens to the best of us. –  Magpie Feb 24 '13 at 23:49

If you remember the "exact" filename(including character sensitivity), then do a locate file_name in console(eg. gnome-terminal).

Note: 1) locate will not return the file location if the filename is "File" and you do a locate file, but fine if you do a locate ile, I hope you got me.

2) gedit makes a copy of every file in the same location as it was saved with a ~ appended to the end of its filename. For eg. if you saved a file file, then a file~ named file should exist unless you have explicity set it not to in gedit. So, there is a chance you may find your file.

share|improve this answer
1  
+1 for the handy tip. –  Magpie Feb 24 '13 at 23:04

Someone correct me if I am wrong but I believe the tmp folder gets emptied when you reboot so you should not expect to find it there. However, if by some luck it is there then you should go to the command line and hit

cd /tmp

then

gedit filename & 

to open. If the file was blank it is likely that the file was not there so you can check whether or not it exists in this folder by typing

ls -l
share|improve this answer
    
Yes, it seems like the document is gone now. I'm able to open the file with your method, but it's empty. I have no idea why it saved in /tmp, I'll just have to be more careful about where I save my documents. –  Antonia Feb 24 '13 at 23:22
    
try list -l to check what is in the /tmp folder (it will list all files present in whichever directory you are in) My method will create a file if it does not exist (I should have emphasised that as it may not have been all that clear) so it was probably not there if gedit opened with a black document. –  Magpie Feb 24 '13 at 23:45

It might be too late now, but you could always try to recover the file with PhotoRec. Given that /tmp/ has undergone a fair number of write/delete cycles by now it's unlikely that you'll be able to recover your file, but not completely impossible.

PhotoRec is included in the testdisk package.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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