Learn Docker With My Newest Course

Dive into Docker takes you from "What is Docker?" to confidently applying Docker to your own projects. It's packed with best practices and examples. Start Learning Docker →

A Shell Alias for Getting Outdated Packages in Arch, Debian and macOS

a-shell-alias-for-getting-outdated-packages-in-arch-debian-and-macos.jpg

I run this from time to time because it's faster than starting a system update and then canceling it if I only want to see the updates.

Quick Jump:

On Arch you can run sudo pacman -Syu --print to do a dry run to get an idea of what will be updated and downloaded without doing it. You can also run a 2nd command if you want to see AUR package updates. But we can do better if all we want to see are potential version updates from A to B.

An alias is nice here because we can run fast dedicated commands to check for updates from both package sources. There’s even options for Debian / Ubuntu and macOS too with apt and brew.

Here’s the commit from my dotfiles that added aliases for each supported OS / distro that my dotfiles supports.

# Arch

This depends on having the pacman-contrib package installed for checkupdates and yay for AUR packages. My dotfiles have an install script that installs these for you.

alias outdated="checkupdates && printf '\n\n' && yay -Qua"

Here’s what the output looks like on my system:

$ outdated
docker 1:29.2.1-1 -> 1:29.3.0-1
groff 1.24.0-1 -> 1.24.0-2
libuv 1.52.0-1 -> 1.52.1-1
taglib 2.2-1 -> 2.2.1-1
wiremix 0.9.0-1 -> 0.10.0-1

openssl-1.1 1.1.1.w-2 -> 1.1.1.w-9

The top section has official Arch packages and the bottom lists AUR packages.

# Debian / Ubuntu

This requires no external dependencies and it gets all packages that can be updated.

alias outdated="sudo apt-get update -qq && apt list --upgradable"

Here’s what the output looks like:

$ outdated
base-files/stable 13.8+deb13u3 amd64 [upgradable from: 13.8+deb13u2]
bash/stable 5.2.37-2+b7 amd64 [upgradable from: 5.2.37-2+b5]
libc-bin/stable 2.41-12+deb13u1 amd64 [upgradable from: 2.41-12]
libc6/stable 2.41-12+deb13u1 amd64 [upgradable from: 2.41-12]
libcap2/stable 1:2.75-10+b3 amd64 [upgradable from: 1:2.75-10+b1]
libssl3t64/stable-security 3.5.4-1~deb13u2 amd64 [upgradable from: 3.5.4-1~deb13u1]
openssl-provider-legacy/stable-security 3.5.4-1~deb13u2 amd64 [upgradable from: 3.5.4-1~deb13u1]
openssl/stable-security 3.5.4-1~deb13u2 amd64 [upgradable from: 3.5.4-1~deb13u1]
sqv/stable 1.3.0-3+b2 amd64 [upgradable from: 1.3.0-3]

# macOS

This requires no external dependencies and it gets all packages that can be updated.

alias outdated="brew update --quiet && brew outdated --formula && print '\n' && brew outdated --casks"

Here’s what the output looks like:

$ outdated
librsvg (2.61.2) < 2.61.3
nginx (1.29.4) < 1.29.5

zoom (5.17.1.31580) != 5.17.5.33531

The top section are regular brew packages and the bottom are casks.

The video below shows running these and a small bonus if you’re using Arch because I also modified my pkg wrapper script to support pkg outdated [--aur] to see more details about each package. I’ve done videos about this wrapper before.

# Demo Video

Timestamps

  • 0:42 – Arch
  • 1:24 – Debian / Ubuntu
  • 2:26 – macOS
  • 2:54 – Looking at the code
  • 4:44 – Bonus command on Arch

Will you use this on your system? Let me know below.

Never Miss a Tip, Trick or Tutorial

Like you, I'm super protective of my inbox, so don't worry about getting spammed. You can expect a few emails per year (at most), and you can 1-click unsubscribe at any time. See what else you'll get too.



Comments