Thursday, August 20, 2009

recover text files by grep command

1.Going system down in a single user mode in linux:

# init 1

2.If you want to recover text file with "test" word on /dev/sda1, you can
try following command:

grep syntax:
grep -b 'search-text' /dev/partition > file.txt

# grep -i -a -B10 -A100 'test' /dev/sda1 > file.txt

3.Then use vi to see file.txt. It is very useful recover text files.
# vi file.txt

No comments:

Post a Comment