DEV Community

Cover image for [FAST] apt: just update this
Everton Tenorio
Everton Tenorio

Posted on • Edited on

[FAST] apt: just update this

Today's Fast and Simple Tip is about apt.

If you use Debian-based distributions and want to update only a specific package, you can use the apt list -u command to list available updates and then filter the package you want to update.

For example, to update only Chromium:

sudo apt install --only-upgrade $(apt list -u | grep -i chromium | sed 's|/.*||' | xargs) -y
Enter fullscreen mode Exit fullscreen mode

Command Explanation:

  1. apt list -u — Lists packages available for an update.
  2. grep -i chromium — Filters only the packages that contain "chromium" in the name.
  3. sed 's|/.*||' — Removes the part after the slash (/), leaving only the package name.
  4. xargs — Converts the multi-line output from sed into a single line and passes it as arguments to apt install.
  5. --only-upgrade — Ensures that only installed packages are updated.
  6. -y — Automatically confirms the update.

This way, you keep your system updated without needing to update everything at once.

Top comments (0)