Skip to main content

Bashrc Update Alias

These days we have all sorts of methods for updating software on Linux systems. Personally, I have systems running NixOS, Fedora, Ubuntu, some with flatpaks & snaps, and fwupd for firmware.

Wouldn't it be nice to have a single bash alias for updating your local system, regardless of origin?

This is my update alias used across all systems, dumped into my ~/.bashrc file

alias updoots="sudo su -c ' \
  hash apt 2>/dev/null && \
    apt update && \
    apt dist-upgrade -y && \
    apt autoremove --purge -y && \
    apt autoclean; \
  hash dnf 2>/dev/null && \
    dnf update -y && \
    dnf autoremove -y; \
  hash nixos-rebuild 2>/dev/null && \
    nixos-rebuild switch --upgrade && \
    nix-collect-garbage; \
  hash flatpak 2>/dev/null && \
    flatpak update -y && \
    flatpak uninstall --unused -y; \
  hash snap 2>/dev/null && \
    snap refresh; \
  hash fwupdmgr 2>/dev/null && \
    fwupdmgr refresh --force && \
    fwupdmgr update -y; \
  '"