I accidentally deleted ~/ … An rm -rf disaster recovery experience

Tuesday evening. I was working on ob and to test the status command I deleted the Go module corresponding to the version I was using at that moment. I open the terminal and start typing:

rm -rf ~/

It was supposed to continue with the module’s path. Instead, I pressed enter too early. The terminal executes. No error, no warning. Just a prompt returning, innocently. I try Super + Enter to open a new terminal. Nothing. I realize. I just deleted ~/

The Initial Reaction

First thought: “Relax, Omarchy makes automatic snapshots on every update.” I reboot the computer, check the snapshots, and they’re there. I restore them. The system boots, but… everything is still gone. Snapshots save the system, not the user configs in the home. All the Omarchy configs… gone.

I had no backup of my dotfiles. I thought snapshots were enough, but I was wrong.

The Restoration Process

At that moment I had only one hour to format the computer and reconfigure everything with my additional personal customizations. I spent all the time between Google and AI searching for:

  • How do you reduce the font in alacritty?
  • How do you set zsh as the default shell?
  • Is it hyprmod or hyprmon?
  • Where are the Omarchy files for the startup logo, screensaver, and about screen?
  • What were the keybinds I used?

Also, Omarchy had changed, so I had to unbind some things.

The Document

When I finally restored everything, I sat down and decided to write it all down. Not a tutorial. Not a guide. A survival document for future me. One hour to rebuild everything. An hour that could have been 5 minutes if I had this document beforehand.

Here is what I documented, exactly as I wrote it after reinstalling:

Restoring Omarchy

Alright, let’s keep it very simple. If you’ve reopened this document, it means Omarchy definitely broke again for the umpteenth time. It shouldn’t be that way because it’s a preconfig, but it was surely your fault, considering last time you had to wipe the system just because you mistyped rm -rf. So with this brief introduction, here’s the complete guide on how to restore your personal Omarchy config.

Terminal configuration

After reinstalling Omarchy and running all updates, you can restore your terminal config as follows:

  • Reinstall zsh with sudo pacman -S zsh
  • Set it as the default shell and update the font size to 11, the file to modify is ~/.config/alacritty/alacritty.toml
general.import = [ "~/.config/omarchy/current/theme/alacritty.toml" ]

[env]
TERM = "xterm-256color"

[font]
normal = { family = "CaskaydiaMono Nerd Font", style = "Regular" }
bold = { family = "CaskaydiaMono Nerd Font", style = "Bold" }
italic = { family = "CaskaydiaMono Nerd Font", style = "Italic" }
size = 11

[window]
padding.x = 14
padding.y = 14
decorations = "None"

[keyboard]
bindings = [
{ key = "F11", action = "ToggleFullscreen" },
{ key = "Insert", mods = "Shift", action = "Paste" },
{ key = "Insert", mods = "Control", action = "Copy" }
]

[terminal.shell]
program = "/bin/zsh"
args = ["--login"]

Once you’ve done that, restore the zsh config with nano ~/.zshrc; you can find the config here -> [[zshrc]] Then install oh-my-zsh:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

It will definitely tell you some plugins are missing, so continue with the following commands:

git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/oh-my-zsh/custom/themes/powerlevel10k
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

And finish configuring powerlevel10k as the theme for that, just remember how you want the config.

Hyprmod

yay -S hyprmon-bin

Then create 2 configurations:

  • Default: monitor at 100hz
  • Work: monitor at 60hz

Fan control

This is one of the trickiest parts because it may not work since I only tried it once and it worked, but I don’t remember exactly what I did. It should be simple, but you never know. Install nbfc from the AUR make sure to install nbfc-linux, not nbfc. Once installed, use the MSI Bravo 17 config:

sudo nbfc config --set "MSI Bravo 17 C7VFKP"
sudo nbfc start
nbfc status

If it doesn’t work, try these steps suggested by Claude:

sudo modprobe ec_sys write_support=1
echo "ec_sys" | sudo tee /etc/modules-load.d/ec_sys.conf
echo "options ec_sys write_support=1" | sudo tee /etc/modprobe.d/ec_sys.conf

Then remember to enable the service at boot:

sudo systemctl enable nbfc_service

The commands are automatically handled by the zsh config, so here they are:

fanmax   # Sets all fans to maximum
fanmid   # Sets all fans to 70%
fanauto  # Returns to automatic mode

Theme, wallpaper, and screensaver

For the theme we use Catpuccin Latte, and for the wallpaper usually the customized Rick & Morty one. So just go to: ~/.config/omarchy/themes/catppuccin-latte/backgrounds and paste it there. You can find the wallpaper here: [[2-my-wallpaper.png]]

For the screensaver, simply modify the file screensaver.txt in the folder: ~/.config/omarchy/branding currently we use a quote from Mr Robot season 04:

The note says, "Don't leave me here."
Do you leave your friend or stay?
> Stay

Just paste it on this site: https://patorjk.com/software/taag/ and choose the font: miniwi, then paste it in the screensaver file.

Fastfetch

Fastfetch is already configured; typing os shows system details with the logo. To modify it, just replace about.txt in the folder ~/.config/omarchy/branding with this text:

I use arch
by the way

Very funny. Just copy and paste it into the screensaver site and select the Bloody font.

Startup screen

For the startup logo I use the Blume one; just paste it into this folder: /usr/share/plymouth/themes/omarchy and rename it to logo.png. You can find the logo here: [[blume.png]]

Git setup

Obviously, to make all projects work we must first download them again. So you’ll need to configure git. To save credentials permanently:

git config --global credential.helper store

Then clone any repo; it will ask for username and token. Create a token with no expiration and paste it. The system will always keep it.

Keybindings

We modified some Omarchy keybindings because we don’t need all the stuff the system configures by default. Here they are:

# Application bindings
$terminal = uwsm app -- $TERMINAL
$browser = omarchy-launch-browser

bindd = SUPER, return, Terminal, exec, $terminal --dir="$(omarchy-cmd-terminal-cwd)"
bindd = SUPER, F, File manager, exec, uwsm app -- nautilus --new-window
bindd = SUPER, B, Browser, exec, $browser
bindd = SUPER SHIFT, B, Browser (private), exec, $browser --private
bindd = SUPER, N, VsCode, exec, omarchy-launch-or-focus code "uwsm app -- code"
bindd = SUPER, T, Activity, exec, omarchy-launch-tui btop
bindd = SUPER, D, Docker, exec, omarchy-launch-tui lazydocker
bindd = SUPER, O, Obsidian, exec, omarchy-launch-or-focus obsidian "uwsm app -- obsidian"
bindd = SUPER, S, Spotify, exec, omarchy-launch-or-focus spotify "uwsm app -- spotify"
bindd = SUPER, M, Slack, exec, omarchy-launch-or-focus slack "uwsm app -- slack"
# Overwrite existing bindings, like putting Omarchy Menu on Super + Space
# unbind = SUPER, SPACE
# bindd = SUPER, SPACE, Omarchy menu, exec, omarchy-menu

Omarchy tells you where to place the file.

Gnome feeds

For RSS feed management, mainly YouTube, I use Gnome Feeds. I still need to reconfigure it and I don’t feel like creating subcategories, etc. Maybe I’ll find a better one, but probably not, at least for local use. Anyway, the package is on AUR -> gfeeds and you can find the feeds here -> [[RSS Youtube]]

Deletion confirmation

I found a small GitHub Gist with a script you can paste here to ask for confirmation before deleting anything:

#!/bin/bash
inp="No";
echo "Are you SURE you want to delete file(s) in $(pwd)? (No/yes)"
read inp

if [ "$inp" ==  "yes" ];then
    echo "Removing..."
    rm $@
else
    exit 1
fi

Save it in ~/.rmconfirm.sh and give it permissions with chmod +x ~/.rmconfirm.sh; the zsh config will handle the rest.

With that, this is everything for now hope this document never becomes necessary.

Conclusion

I wrote this post not to brag about recovering everything in one hour. Not to share it, but to teach myself a lesson: Document everything. Especially in the world of computing, even the things you think you won’t need to document. Did this document help me? No, and I hope it never will. But the next time I mess up (and I will), it will be there.