How I can recover a previous version of a file?

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.