I deleted my file content in the file how can i recover back using timestamps is it possible for ex: I am having the file1.txt
cat file1.txt
i am linux user
i am new to linux
i love linux After sometime i later i delete the file content
cat file1.txt
empty: how to get back the content again in the file
2 Answers
Depends how you edited / deleted and how many times the content. Some editors like gedit creates a backup copy of file before saving with the '~' (tilde) suffix. These files with the '~' suffix are hidden files for most of file managers (like Nautilus). So, with a little bit of luck you can recovery your lost content from these files.
Backup file for some text document files will be automatically created if it was opened using gedit text editor.Which was hidden and it ends with ~.By default this text document backup option was enabled.If you dont want gedit to create any backups.Then you can disable this option from,
Gedit-->Edit-->Preferences-->Editor
To ensure it's presence try ls command after cding into the current directory.If it was located, then copy its contents to the main file by running the below command,
cat file1.txt~ > file1.txt 1