• Around The HomeToggle Menu

    • Entertainment
    • Productivity
    • Smart Home
  • FamilyToggle Menu

    • Parenting
    • Toys
    • Pets
    • Travel
  • Product ReviewsToggle Menu

    • Phones
    • Tablets
    • Laptops
    • Desktops
    • Wearables
    • Audio
    • Cameras
    • Headphones
    • Printers
    • Smart Home
    • TVs
    • Gaming and Video
  • One Cool ThingToggle Menu

    • Frugal Tech
    • Kickstarters
    • Videos
Techwalla
  1. Home
  2. Around The Home
  3. Productivity
  4. How to Recover Deleted Files in Linux

How to Recover Deleted Files in Linux

March 31, 2015
By: Techwalla Computers Editor
  • Share
  • Share on Facebook

How to Recover Deleted Files in Linux. Despite best efforts, there are times when you accidentally delete files you still need. There are even times when you delete a file that you don't realize you'll need later. It's best to simply back up files prior to deleting them, since it can be a hassle to recover them. Even so, it is possible to recover deleted files in Linux if you know how.

Step

Determine the partition in which the file you wish to recover was located. You can do this easily using the "pwd" command in the shell console.

Step

Unmount the current directory using the "unmount" command. This will limit the potential that the file will be overwritten while you try to recover it. Be aware that this is not possible if the file is located in the "/root" directory since it is always mounted. In this case, you'll need to remove the hard drive and place it in another Linux based PC and continue the recovery procedure (a very dangerous option, but the only one available in this case).

Step

Use the "debugfs" command. The "debugfs" command is used to handle most major errors and bugs that can occur in Linux. It enables you to correct problems without having to suffer a system crash or cause a restart. Include the file system where the deleted files are located: "debugfs usr/personal" would access the usr/personal directory.

Step

Use the "lsdel" once you have begun the debug of the file system. This command generates a list of all of the files that have been deleted on the file system. Be patient, as this can take a long time when you're dealing with larger caches of deleted files.

Step

Recover those files you wish to undelete by typing "dump filename". The "inode number" is the number displayed in the first column of the report you receive when using the "lsdel" command. This will write those files to the current partition you are working in, backing up those files.

Show Comments

Related Articles

How to Recover Deleted Yahoo Email Messages

How to Recover Deleted Yahoo Email Messages

Around The Home
Productivity
By: Lita McLeary
How to Recover Deleted Pictures

How to Recover Deleted Pictures

Around The Home
Productivity
By: Ken Burnside
How to Recover Deleted Text Messages From a Phone

How to Recover Deleted Text Messages From a Phone

Around The Home
Entertainment
By: Lita McLeary
How to Recover Files in Adobe InDesign

How to Recover Files in Adobe InDesign

Around The Home
Productivity
By: Richard Kalinowski
How to Recover Unallocated Drive Space

How to Recover Unallocated Drive Space

Around The Home
Productivity
By: Jack Busch
How to Recover Deleted AOL Email

How to Recover Deleted AOL Email

Around The Home
Productivity
By: Aksana Nikolai
  • HOW WE SCORE
  • ABOUT US
  • CONTACT US
  • TERMS
  • PRIVACY POLICY
  • COPYRIGHT POLICY
  • Advertise

An error occurred. Try again later.

Thanks for signing up!
© 2018 Leaf Group Ltd. / Leaf Group Lifestyle

Get great tech advice delivered to your inbox.

Keep your family productive, connected, entertained, and safe.

Please enter a valid email.