Foremost is well known application used in Linux to recover permanently deleted files. It can recover deleted files from number of files systems using data carving recover method. It support following file systems: FAT, ext3/4 and NTFS. Foremost is basically command line tools also available in Ubuntu live cd so you can even use it without installing in Ubuntu. It is safe to run this from live cd instead of running from operating system installed in hard disk. There may be more chance OS can overwrite deleted file location.
How to Install Formost
Open terminal and run below command to install foremost.
sudo apt-get install foremost
How to Use
There are various switch available that you can use.
-l : To specify file type need to recover.
-w : To obtain only an audit of recoverable files.
-i : Input file name or device.
-o : Output folder name where recovered file will be stored.
Use following syntax to run this utility. Foremost also can recover file from disk images so you can use image file name as well as device name as input media.
foremost <switches> -i <input> -o <output>
Replace switches, input and output with correct setting.
Available file types that can be used with -t switch.
jpg,gif, png, bmp, avi, exe, mpg, wav, riff, wmv, mov, pdf, ole, doc, zip, rar, htm, cpp