Nobody likes to delete a file accidently and then feel desperate as it there is no way to restore it. linux is a reliable and powerful operating system since a lot of efforts and precautions have been made to avoid these situations. Fortunately, today I am going to share some useful tricks to recover deleted files in Linux.
First you can use the ‘ls’ command to look for the file in the directory where you have deleted it. After that, you can use the ‘ find ’ command. This command allows you to look for a file in a certain directory, as well as its subdirectories. It also helps to match a specific name and restore the file.
Another alternative, in case the file was deleted while running the ‘rm’ command with the parameter ‘-f’ is to use the ‘fsck’ command. This indicates whether the file has been deleted and shows the correct path where to restore it.
Finally, the simplest way to restore deleted files on Linux is by using an undelete tool, such as ‘ extundelete ’. First of all, you must install the tool on your system. Then you can run the command with the exact path of the deleted file and the tool will look for the file deleted and restore it.
All these solutions can be used to restore files in Linux. Still, the best way to avoid regretful situations like these is to be aware of the files you delete and to avoid deleting them accidently. Moreover, it is very important to have a backup system in place that can help to restore in case of emergency.
In conclusion, hopefully you will never have to worry about accidental file deletion. However, if you ever find yourself in a difficult situation, these solutions may be the best path to pursue in order to restore the file quickly and with minimum effort.