File Recovery

Recovering content of deleted files

Find disks using mount and looking for sd[a-z]:

$ mount
/dev/sdb on / type ext4 (rw,relatime,discard,errors=remount-ro,data=ordered)
...

Then grep for any known text:

$ sudo grep -a -C 200 -F 'Insert text here' /dev/sdb | tee /tmp/recovered

This will output a lot of garbage as well, so you can then filter on ASCII lines only:

$ grep --color=never -aoP '^[[:ascii:]]*$' /tmp/recovered

Last updated