When we connect to our Linux systems like Ubuntu, Debian, Mint and Kali we see that there is a notification like below. This notification says that we hve new updates and we need to install them. Some of the updates are bug fix and some of the are security update. We will look how to install them. More information about
apt can be found int the following tutorial.
Get Latest Software Update Information with apt-get update
apt-get update command is used to fetch new updates from our repositories. This information is compared with already installed packages information and new updates are determined.
$ apt-get update
Update All Packages with apt-get dist-upgrade
We have get the latest package update information with the previous command. In this step we will download the new packages. Package managers generally prefers downloading only changing part of the packages where we can call them delta packages. We will use
apt-get dist-upgrade . We will prefer dist-upgrade because during the update some conflicts can be occurs and we need to resolve them.
dist-upgrade will resolve them appropriately mostly without asking any question. We also need root privileges.
$ sudo apt-get dist-upgrade
Remove Cache Files
During times downloaded packages are stored in the apt cache directory. This may take some space which is useful for other things. This cache provides some speed and bandwidth saving in some situations but in these days it is not so much required. We can clean cache like below.
$ sudo apt-get autoremove
Update Single Command
Providing these commands one by one is tedious task and I generally prefer single shot command where I chain commands together. I chain them using bash
&& is used to read previous command output and continue if there is no error. So
&& will make whole update procedure in a successful way.
$ sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get autoremove