Q: How do I undelete a file in linux?

A: First, try not to accidentally delete a file in linux...

From http://www.brighthub.com/computing/linux/articles/34156.aspx:

"Many new users of Linux are surprised to learn that no "undelete" application is part of a distribution. If they research the problem a little, they'll find that specialized hard drive searches using Grep or the Linux write command can be used to "dump" part of the contents of the hard drive into a file or folder. This is an inconvenient and lengthy process best done soon after the deletion and run from a Live CD instead of from an active partition.

Technically, the EXT3 file system does not support an undelete method itself [...]."

Also see http://www.unixguide.net/linux/faq/04.02.shtml.

With that in mind, follow the howto on the following URL, http://tldp.org/HOWTO/Ext2fs-Undeletion-4.html.

Or just keep good and tested backups...

Stop Spam Harvesters, Join Project Honey Pot


Get a free SSL certificate!


The leading nonprofit defending digital privacy, free speech, and innovation.


The Linux Foundation provides a neutral, trusted hub for developers and organizations to code, manage, and scale open technology projects and ecosystems.


Kubuntu is an operating system built by a worldwide community of developers, testers, supporters and translators.


 43ef5c89 CanonicalUbuntudarktext