home :: tech :: recovering-tmp-file
Recovering /tmp file
Okay, so I did something very stupid and saved a file under /tmp, switched off
my computer, and then booted it back up later to look for the file. (I blame
lack of sleep.) Anyway, it was a simple text file that I didn't really want to
write up again, so I decided to try to recover it. Since the file was on my
laptop, and since Macs have a cool Firewire Target
disk mode, I connected to my laptop from my Mini, and grepped the
partition (it wasn't a really large file, but I hate having to retype
something):
grep -a -B100 -A100 'sentence that i remembered' /dev/partition > file.out
While that ran, I just did my usual: read blogs, e-mail, and articles, and
contacted some friends on the phone, etc. I came back every once in a while to
see if file.out had any size. After about the fifth time checking, it grew to
a whopping 40k! ;-) I then proceeded to use vim to extract the text I really
needed, and I was done! Woo-hoo! This is something I can tell my students
about who were asking what good the command line was. 'Course, they could
retort and said I should have just saved my file somewhere else, but I think
that's beside the point: the file was already lost, and I was trying to
recover it. I'll see what they say Friday. :-)
[all posts in /tech/]
[permanent link]
|