Updating and Upgrading Packages

Updating and Upgrading Packages

By Jared York | JaredYork | 12 Jul 2019


Hey there!  In this edition of my series, Linux Terminal Survival Guide, we will be taking a look at how to update and upgrade our installed packages.  Of course, we will be learning how to do this via the terminal.

To begin, let's open our terminal.  If you recall from our last guide, you can open the terminal by searching for it via pressing the super key (Windows key or symbol of another operating system.)

351665157-93876f3d4c99dc642c5555385f5928104dcaee28b9956891a3822727319ee4bf.jpeg

Once you see it, you can click on the icon, or simply press 'enter'.

351665157-1eb7130ecf25585fb3521ed8813ad7b00a7e84bfb31e0688fc17e3d1b7b1fb6b.jpeg

(You may notice the wallpaper.  It's the only thing that made Windows tolerable, I like the Bliss wallpaper.  Don't judge me, thanks.)

When I run updates on my system, I usually run a specific sequence of commands:

  • Update the list of available packages
  • Upgrade installed packages to the latest version
  • Update the Linux kernel
  • Auto-remove old, unnessary packages
  • Safely clear the cache of package files used when updating

It might seem a bit daunting to run these commands, but don't worry.  Let's walk through them one at a time.

Update the List of Available Packages

Since your terminal is now open, we can type in the following command:

sudo apt update

351665157-abddb4b9cae9d0c7d9d8cf32b9843f2a131bfcea6dae8757a84634060f3cb555.jpeg

Now that the package list has been refresh, we can now update our existing packages to the latest version.  To actually update our packages, we can utilize the following command:

sudo apt upgrade

351665157-4e824c950489190309dacc7aa298fcb2837d13fe77ade364cdca50c93a5d6433.jpeg

More often than not, we will also want to upgrade the Linux kernel.  This is a very important step to do.  Kernel updates fix various loopholes, exploits, and provide improved hardware compatibility.  Usually, you will want to use the command we're about to type to upgrade the Linux kernel rather than attempting to install the latest version manually.  This is because various drivers, including your graphics drivers will probably not work with the absolute latest kernel version.  This is why it's generally a good idea to upgrade to the version your distribution recommends via the command:

sudo apt-get dist-upgrade

351665157-cc6c633f7ff7a9a83e4cb91e24712a46d634ed1a9dfa2e40de05c87914ce40b3.jpeg

As you've been updating and upgrading packages, it's a good idea to remove old temporary package files that build up and clutter your computer over time.

We can clean out old package files using the command:

sudo apt clean

351665157-dd949e821d051b500de2ccd5b639afcfd8c0ef30c4793a4dd4c60e7c06a6b1a6.jpeg

Boom!  Now all we have to do is run the last command:

sudo apt clean

This will clear the local repository of package files retrieved.  Technically we don't have to run this if dselect is enabled, but it doesn't hurt.

And that's a wrap to our series, Linux Terminal Survival Guide.  Stay tuned for our next episode, and make sure to keep learning.

 


Jared York
Jared York

business owner, programmer, game developer, educator, coffee enthusiast


JaredYork
JaredYork

The blog where I ramble about tech, crypto, and other things that interest me.

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.