I was doing command line stuff while tweaking on coffee and having a bit of an anxiety attack and I accidentally deleted my home directory.

But I have automated daily snapshots saved which is a ZFS feature. And I was able to simply restore from the latest snapshot which was from this morning. So this is the first time ever that I got any benefit from being on ZFS.

  • loathsome dongeaterOPA
    link
    fedilink
    English
    arrow-up
    4
    ·
    3 hours ago

    The gist is this:

    • I was using a terminal file manager called nnn
    • You can make bulk selections in it using the space key
    • However, unlike a graphical file manager, selections across directories persist. Like if you select some things in dir1, then traverse to dir1/.. and select stuff there, the selections in dir1 will persist. In hindsight this sounds like an antifeature.
    • Due to frantic key presses I accidentally traversed to /home and selected /home/name
    • Then I traversed to the actual directory where I wanted to make the selections, did that and deleted the selections
    • It was unknown to me that /home/name was also selected
    • nnn just executes shell commands to perform deletions. In my shell profile rm is aliased to rm -iv so the output conveyed to me what was going on (my home directory was being nuked)
    • I ctrl+c’d the operation and restored my $HOME from the snapshot