Use Grep to Recover Deleted Text Files On Your Linux Box

By Lowell Heddings on August 19th, 2010

Over at the Atomic Spin weblog, they’ve written up an interesting tip that uses grep to recover files. Here’s the brief command you’d use, but hit the link for the full explanation.

Since the file I was hoping to recover was a text file, and I knew a fair amount about it (such as approximate file size and some text that was definitely going to be included), finding it actually turned out to be fairly simple task using grep:

grep -a -B 25 -A 100 'some string in the file' /dev/sda1 > results.txt

Undelete! [Atomic Spin via HN]

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 08/19/10
More Articles You Might Like

Enter Your Email Here to Get Access for Free:

Go check your email!