If you deleted a text file or you made a quick format that erased an important text file, first of all, if it is your boot disk do not boot from it again as it may overwrite the sectors where the lost data is stored and now marked empty. If it is not a boot disk, do not write any new data to the disk.
If you followed the recommendations above, there is a good change the data can be recovered. Usually you would like to use Photorec from another computer or from a live Linux CD and save the recovered files to another disk.
However if the text file did not have an extension (text files created with gedit do not have extensions by default), you will not be able to use Photorec. In that case you may try the command bellow from a live Linux CD or from another linux machine.
sudo grep –binary-files=text -C 1000 ‘tex string on the deleted file’ /dev/sdX1 > outfile.txt
You just need to remember a word that was in the text file you are trying to recover. It should be a word that does not come up on any other text file. Then edit /dev/sdX1 and change sdX1 with the correct path to the disk where the erased text is.
Good luck with the recovery! If this text was useful, please do not forget to link to this blog.