Update a Single Package With apt Command in Ubuntu and Debian

How do you update your Ubuntu system in the command line? You use the apt update (to refresh the package cache) and apt upgrade commands.

sudo apt update && sudo apt upgrade

It updates all the installed apt packages that can be upgraded at once. This includes the Linux kernel version, too.

This seems like a good thing, especially for desktop users. That may not be the case for Ubuntu server users where you have crucial web services running.

If you want to be selective about the updates and only want to upgrade a single package, use this command:

sudo apt install --only-upgrade package_name

Let’s see it in a bit more detail.

Upgrade single package using apt command

The first step is to update the local package repository cache so that your system knows about the availability of new package versions.

sudo apt update

This is optional. Check if the package you want to upgrade is in the list of upgradable packages.

apt list --upgradable

If the desired package has a new version available, you can choose to upgrade only this single package with this command:

sudo apt install --only-upgrade package_name

If you run the apt install command on an already installed package, it will be upgraded to the next available version.

But if the package is not installed already, the apt command will also install it.

This is why the --only-upgrade part is necessary. With that option, the apt command will only upgrade an already installed package. It will not install the package if it is not already installed.

Not the best-suited example for Ubuntu server users, but you can still see how I upgraded only one of the seven upgradable packages in the below screenshot.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Server Status

Aradippou Chat 1 Chat 2 Larnaca Limassol Nicosia

Chat Links

Official Links.

1. Chat 1.
2. Chat 2.

Alternative Mirror Links.

1. KiwiIRC 1.
2. KiwiIRC 2.

Other Web Clients.

1. IrcCloud.

Recent Posts

Related Posts:

Advertisement

Archives

Super Club Radio

Mighty Deals

CyIRC

CyIRC Tweets

Scroll Up
Fatal error: Uncaught WMAC\JSMin_UnterminatedStringException: WMAC\JSMin: Unterminated String at byte 1180: "+o.accessToken}}).then(e=>{if(!e.ok)throw e;return e});return a.catch(e=>{console.error(`Failed to logout chatrix session. deviceId: ${o.deviceId}`)}),a}})(); in /home/bszucbfe/public_html/wp-content/plugins/clearfy/components/minify-and-combine/includes/classes/ext/php/jsmin.php:215 Stack trace: #0 /home/bszucbfe/public_html/wp-content/plugins/clearfy/components/minify-and-combine/includes/classes/ext/php/jsmin.php(157): WMAC\JSMin->action(2) #1 /home/bszucbfe/public_html/wp-content/plugins/clearfy/components/minify-and-combine/includes/classes/ext/php/jsmin.php(96): WMAC\JSMin->min() #2 /home/bszucbfe/public_html/wp-content/plugins/clearfy/components/minify-and-combine/includes/classes/class-main.php(375): WMAC\JSMin::minify('(function(){"us...') #3 /home/bszucbfe/public_html/wp-includes/class-wp-hook.php(324): WMAC_PluginMain->jsSnippetcacher('(function(){"us...', '/home/bszucbfe/...') #4 /home/bszucbfe/public_h in /home/bszucbfe/public_html/wp-content/plugins/clearfy/components/minify-and-combine/includes/classes/ext/php/jsmin.php on line 215