How To Update Ubuntu

By bhagwatchouhan
How To Update Ubuntu

This tutorial explains the steps required to update Ubuntu 18.04 and also clean the older packages which are not required anymore. The same commands can be used for older versions of Ubuntu.

 

Update

The update command updates the list of available packages and versions. It does not make any changes to the installed packages, nor install any new packages. The command can be used as shown below.

# Update directly
apt-get update
# Update using sudo sudo apt-get update

 

Upgrade

The packages installed on Ubuntu can be updated using below mentioned commands. These will update all the packages having a newer version as compared to the installed version.

# Upgrade directly
apt-get upgrade
# Upgrade using sudo sudo apt-get upgrade
# OR
# Upgrade directly apt-get dist-upgrade
# Upgrade using sudo sudo apt-get dist-upgrade

The major difference between the commands upgrade and dist-upgrade is that upgrade simply install the newer version of the packages already installed on the system, but dist-upgrade not only install the newer version, it also remove or install new packages as part of the package update.

If we install a package using an upgrade and it needs to either remove or install other packages, the update will be held back without making changes to other packages. We can later use the command dist-upgrade to complete the update process after making sure that the changes won't bring any major issue.

 

Autoclean

The command autoclean removes the package files which are no longer downloadable and won't be used by the system anymore, hence freeing up space. We can run the command as shown below.

# Update directly
apt-get autoclean
# Update using sudo sudo apt-get autoclean

 

Autoremove

The command autoremove removes the packages that get installed automatically to meet the dependencies of packages installed by us, but no longer required since we have either removed the package or updated it.

# Update directly
apt-get autoremove
# Update using sudo sudo apt-get autoremove
# OR apt-get --purge autoremove

Using purge will also remove the files associated with the package.

These are the commands required to update the packages installed on the system.

Share this blog:

Profile picture for user bhagwatchouhan
bhagwatchouhan