TestDisk is a partition scanner and disk recovery tool that can recover lost partitions and recover disk and data. If you are using Ubuntu Linux, its a good idea to keep recovery tool installed in the system. In case you accidentally delete or alter a partition, it can be recovered by using TestDisk. If you have lost files, it can recover lost files. To get and install TestDisk in Ubuntu, follow this guide.
Press Ctrl+Alt+T to bring up terminal window in Ubuntu. You can install Testdisk by using following command in the terminal.
sudo apt-get install testdisk
To run Testdisk as root, use following command (depending on package name):
Hit Enter. This should opened Testdisk in Ubuntu.
OR here is the command depending on package name.
If you encounter the following error: ‘Unable to locate package testdisk‘, you have to enable the universe repository first or you misspelled something in command. Here is guide to troubleshoot ‘unable to locate package’ error.