We have examined the
apt-get and its sub 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 a 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 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 deb or apt-get package database. The newer version information will be written into this database. But keep in mind that packages will not upgraded as it is separate or next step. This is useful if we want to upgrade some specific packages and do not upgrade others.
Update information will be fetch from configured repositories which is
us repositories in this example as we can see. This will only download packages metadata those have updates and do not download whole packages.
$ sudo apt-get update
The last step is upgrading the packages. We have all ready 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