Drop to the Linux command line. If you're on a graphical user interface press <CTRL>+<ALT>+1 and you should be on terminal 1. Log in like you usually would. Keep in mind you'll need root privileges later on...
Tell all users you're going to single user mode:
wallWait a bit and press <CTRL>+D to put in a command. Go to single user mode to prevent stuff being written to disk:
init 1Use grep to recover your file:
grep -i -a -B20 -A100 'some text from the file' /dev/sda1 > dump.txtThe grep commands are:
- -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.
If you now have a file too big to edit, try copying only a few lines to another file:
head -100 dump.txt > 100lines.txt