How I can recover a previous version of a file?

53,966

Solution 1

If you used GEdit and you havent disabled the backup function, then there must be a hidden file with name similar to your file but with ~ appended to it. So if your file name is somefile.txt then look for somefile.txt~ in the same directory. This is the backup file and will give you your files state before last save.

Solution 2

binW's solution is the only solution for a problem like this where you have no backup or other versioning software in place. It is a one-time rescue that may help you this one time. If you save again, that backup will be replaced and you lose anything from before that backup. I hope this works for you.

Generally speaking, if you need version control or backup, use backup or version control software. You say this is a critical file so you should treat it like one. Look at version-control tools like git or bzr and RabitVCS to tie them into the normal user interface.

But that is not enough. If this file is as critical to your existence as you suggest, please do some backups once in a while. There's no excuse these days not to. They take (at most) an hour to set up and using tools like DropBox or Amazon S3, are extremely cheap to store quite a lot of data off-site. Take a look at the available backup tools.

Neither of these systems will provide you with complete peace of mind. You want both a VCS for short-term and long-term histories and an off-site backup for long term data integrity.

Share:
53,966

Related videos on Youtube

Rodrigo Graça
Author by

Rodrigo Graça

Geek

Updated on September 18, 2022

Comments

  • Rodrigo Graça
    Rodrigo Graça over 1 year

    I modified a .txt file and saved it. When I opened it again, I saw that I deleted one thing from the last version I saved. So I would like to know if I can recover what I deleted?

    This file is very important to me. You have to help me! My life is on this file.

    I didn't delete anything, I only edited the file. When I tried to save I had get an error saying that it could not read some characters so I closed the editor and when I opened it again some lines just disappeared.

  • Rodrigo Graça
    Rodrigo Graça almost 13 years
    How i turn on hidden files? Because i can't see any ~somefile.txt
  • Oli
    Oli almost 13 years
    Control+H or View → Show Hidden Files.
  • Rodrigo Graça
    Rodrigo Graça almost 13 years
    Yhea! I have dropbox and i know that backups is important. I was to make one copy for the coming month. From now i will use Google Docs because i have acess to previous file versions and is on the cloud, so i dont lose it.
  • Rodrigo Graça
    Rodrigo Graça almost 13 years
    Only ....htaccess ;)
  • Oli
    Oli almost 13 years
    Still... Don't rely on that as your only copy. Google had lost user data before.
  • Soren A
    Soren A over 3 years
    And if OP'sfile is on a local mounted partition ? How do you expect Google drive to help in that case ? Hint: it doesn't.
  • Ferroao
    Ferroao over 3 years
    A local mounted partition can be synced to GD