Today had some important markdown file that accidentally deleted on my SSD and had to go over the recovery of it.
All I did was this:
run sudo systemctl status fstrim.timer to check how often TRIM runs on my system (apparently it runs weekly and the next scheduled run was in 3 days)
run sudo pacman -S testdisk
run sudo photorec
choose the correct partition where the files were deleted
choose filesystem type (ext4)
choose a destination folder where to save recovered files
start recovery
10-15 minutes and it’s done.
open nvim in parent folder and grep for content in the file that I remember adding today
That’s it - the whole process was so fast. No googling through 10 different sites with their shitty flashy UIs promising “free recovery,” wondering whether this is even trustworthy to install on your machine, dealing with installers that’ll sneak in annoying software if you click too fast, only to have them ask for payment later. No navigating complex GUIs either.
I was so thankful for this I actually donated to the maintainers of the software. Software done right.


Last time I deleted a plaintext file I just grepped for it.
cat /dev/nvme0n1 | strings | grep -n "text I remember"Had to hone in on the location with
head -candtail -cafter I found it, then simply did acat /dev/nvme0n1 | tail -c -123456789012 | head -c 3000 > filerecand trimmed the last filesystem garbage from the ends manually.That was so eye-opening for me when I figured out you can just grep a block device for files unlinked by the file system but not yet physically overwritten. Magically reanimating lost files can be such an incredibly simple operation.
That’s the way.
Edit: no need for cat here.
I don’t like to use
<in combination with pipes, I find it harder to read. One is left to right the other right to left, and<is also just plain weird in its specifics.catis a stylistic choice avoiding needless notational complexitystrings/dev/nvme0n1| grep -n "text I remember"tail -c -123456789012/dev/nvme0n1| head -c 3000 > filerecNo need for
<complexity either.Oh right I misunderstood.
I didn’t do that because I was planning to switch out
stringsin that line. First inserting the tail and head before it to hone in on the position, then removing it entirely to not delete “non-string” parts of my file like empty newlines.cat /dev/nvme0n1 | strings | grep -n "text I remember"cat /dev/nvme0n1 | tail -c -100000000000 | head -c 50000000000 | strings | grep -n "text I remember"cat /dev/nvme0n1 | tail -c -123456789012 | head -c 3000 > filerecThis would be the loose chain of commands I went through, editing one into the next. It’s nice keeping the “constants” like the drive device that are hard to type static. That way mentally for me the command starts only after the first pipe.
Oh fascinating you can just do it manually.