How to Undelete Files in Ubuntu

Written by jason spidle Google
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Undelete Files in Ubuntu
(Jupiterimages/ Images)

The Linux-based Ubuntu operating system does not come with an undelete application out of the box, but due to the open source nature of Ubuntu, you can easily install software that can aid in recovering accidentally deleted files. "Foremost" is a tool available in the Ubuntu software repository that was designed by the United States Air Force to discover and rebuild files that have been deleted from Linux-formatted hard drives. The software originally served strictly forensic purposes until it was released to the public for consumer usage. Foremost is a command line tool that can undelete files that have been removed months ago. As with any data recovery package, Foremost is most effective when used immediately after the file is accidentally deleted.

Skill level:

Other People Are Reading


  1. 1

    Launch Terminal by selecting "Applications," "Accessories" and then "Terminal."

  2. 2

    Type "sudo apt-get install foremost" and press "Enter" to install Foremost. You will need to enter your administrative password to continue.

  3. 3

    Type "sudo fdisk -1" and press "Enter" to determine the mount location of the hard drive on which you need to undelete files. In particular, you will need to note the "Device Boot" name (it will be displayed as "/dev/[PARTITION]" where partition is the name of the hard drive) for the hard drive you need to recover from, as this name will be used in proceeding steps.

  4. 4

    Type "sudo mkdir /recovery/foremost" to create a recovery directory that is located in the root folder of the system.

  5. 5

    Type "sudo foremost -w -i /dev/[PARTITION] -o /recovery/foremost" and press "Enter" to scan the hard drive for recoverable files. Be sure to replace "dev/[PARTITION]" with the correct device name as noted above.

  6. 6

    Type "sudo foremost -t [FILE TYPE] -i /dev/hda -o /recovery/foremost" and press Enter" to undelete files of a certain type. Replace "[FILE TYPE]" with the file extension (such as jpg, txt, doc, zip, mpg, etc.) of the file you wish to undelete. The files will be restored to the "/recovery/foremost" folder that was created.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.