|
For programmers and web developers the chances are high that the data lost is a text file.
The traditional UNIX way to recover files is by using the 'grep' function to scan your hard disk partition and search for a block with the keywords you entered.
Once found you take some lines before and some lines after and save the whole lot to a recovered text file. With some (a lot) luck you find your hard work back in this document.
this method is ONLY useful if deleted file is text file
EXAMPLE:
grep -a -B[size before] -A[size after] ‘text’ /dev/[data_partition] > file.txt
Where,
* -i : Ignore case distinctions in both the PATTERN and the input files i.e. match both uppercase and lowercase character.
* -a : Process a binary file as if it were text
* -B Print number lines/size of leading context before matching lines.
* -A: Print number lines/size of trailing context after matching lines.
To recover text file starting with 'pizza' word on /dev/sda1 you can try following command:
# grep -i -a -B100 -A1000 'pizza' /dev/hda1 > file.txt
Finally use vi to view the resulting file.
If you are using ext2 file system, try out recover command.
|