We have examined the
apt-get and its commands in a detailed manner previously.
apt-get is used to manage installed packages in a Linux distribution like Ubuntu, Debian, Mint, Kali, etc. Here we will look simply
sudo apt-get update and related commands to update a deb based Linux distribution. For detailed tutorials look following.
Get Root Privileges with “sudo”
Actually this is not separate command or step. It is used with
apt-get update but I wanted to explain in detail.
apt-get command requires root-level privileges to change package database. This is security enforcement for the Linux systems. In order to write changes to the apt database, we need to be root or root-level user or gain privilege with sudo command. For example, the following command will run as root and provide
root user information.
$ sudo whoami
Update Package Information About Repositories
Now we will examine the real command
sudo apt-get update . This command will update the deb or apt-get package database. The newer version information will be written into this database. But keep in mind that packages will not be upgraded as it is separate or the next step. This is useful if we want to upgrade some specific packages and do not upgrade others.
Update information will be fetched from configured repositories which are us repositories in this example as we can see. This will only download packages metadata that have updates and do not download whole packages.
$ sudo apt-get update
The last step is upgrading the packages. We have already the information about updates and this step will trigger the upgrade process the real packages will be downloaded, installed and configured accordingly. We will use
sudo apt-get upgrade which requires root privileges too.
$ sudo apt-get upgrade