This is the beginning of a series where I cover the basics of using the terminal in Debian/Ubuntu based distributions. Chances are, if you’re using another distribution that isn’t based of Debian (or Ubuntu), you already know these basic commands. The goal of this series of tutorials is to start you on your journey of utilizing the command line in Linux. Without further ado, let’s start by learning how to update and upgrade your computer via the terminal.
If you’re using Ubuntu, you can open an instance of the terminal by pressing the super key (also known as the Windows key associated with that other nasty operating system, haha.) Next, you should see a search box at the top of your screen where you can search for an application. Start typing in “terminal.” As you type, you should see the terminal application appear like so:
Once the icon appears, feel free to click on it or simply press enter.
When I update and/or upgrade my system, a run a series of commands that perform the following steps:
- Update the list of available packages
- Upgrade installed packages to the latest version
- Update the Linux kernel
- Auto-remove old, unnecessary packages
- Safely clear the cache of package files used when updating
Having to run these five commands may be a little daunting, but don’t worry. Let’s try these one by one.
Update List of Available Packages
Now that your terminal is open, type in:
sudo apt-get update
Now that we have a refreshed list of packages, next we can update our existing packages to the new versions that we’ve retrieved. We can update our packages by typing:
sudo apt-get upgrade
Occasionally, we will also want to update the Linux kernel. This is actually a very important step to do. Kernel updates provide fixes to loopholes, exploits, better hardware compatibility, increased speed, and other new features. It’s generally recommended that you use your terminal to upgrade your Linux kernel instead of manually downloading the latest and installing. If you try to install the absolute latest kernel, there’s a good chance your graphics drivers, and many of your other applications will break. This is why it’s good to upgrade to the kernel your distribution recommends via the command:
sudo apt-get dist-upgrade
After upgrading our packages, we will want to get rid of packages that are no longer needed by the newest releases of the software we have installed. We can run the following command to do so:
sudo apt-get autoremove
After you’ve been running the sudo apt-get update command a bunch of times, you might want to clear out the old temporary package files. These files can build up as you install and upgrade packages. We can clean out the old package files with the command:
sudo apt-get clean
Now you know the main commands to update and upgrade your Linux system running a Debian or Ubuntu variant! In the next part of this series, we will take a look at another useful tool that you can use via the terminal. Until then, stay tuned! If you found this guide helpful, please be sure to share it on your social media platform of choice. You can also fill out the form here, to receive news on our upcoming tutorials and courses!