This post will guide you how to update ubuntu packages to keep your system up to date from the command line. How do I update all packages from the graphical user interface in your Ubuntu Linux.
To update Ubuntu packages to the latest version, and you need to update the Apt index firstly to download package information from all configured sources with the following command:
$ sudo apt update
devops@devops:~$ sudo apt update Hit:1 http://mirrors.aliyun.com/ubuntu bionic InRelease Hit:2 http://mirrors.aliyun.com/ubuntu bionic-security InRelease Hit:3 http://mirrors.aliyun.com/ubuntu bionic-updates InRelease Hit:4 http://mirrors.aliyun.com/ubuntu bionic-backports InRelease Hit:5 http://mirrors.aliyun.com/ubuntu bionic-proposed InRelease Hit:6 https://download.docker.com/linux/ubuntu bionic InRelease Hit:7 http://ppa.launchpad.net/team-xbmc/ppa/ubuntu bionic InRelease Hit:8 http://repository.spotify.com stable InRelease Hit:9 https://repo.skype.com/deb stable InRelease Get:10 http://dl.bintray.com/apache/cassandra 311x InRelease [3,183 B] Fetched 3,183 B in 1s (2,651 B/s) Reading package lists... Done Building dependency tree Reading state information... Done 151 packages can be upgraded. Run 'apt list --upgradable' to see them.
From the above outputs, you would notice that how many packages need to be upgraded in your current Ubuntu system. Then you can type the following apt upgrade command to upgrade packages.
$ sudo apt upgrade
devops@devops:~$ sudo apt upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following NEW packages will be installed: xdg-desktop-portal xdg-desktop-portal-gtk The following packages will be upgraded: ...... 151 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. Need to get 269 MB of archives. After this operation, 21.3 MB disk space will be freed. Do you want to continue? [Y/n] ...... Setting up ubuntu-desktop (1.417.3) ... Processing triggers for initramfs-tools (0.130ubuntu3.8) ... update-initramfs: Generating /boot/initrd.img-5.0.0-27-generic Processing triggers for libc-bin (2.27-3ubuntu1) ...
If you only want to upgrade a specified package called firefox, and you can type the following command:
$ sudo apt install firefox
If firefox package is installed and its version is also the latest. and you will get the following outputs:
devops@devops:~$ sudo apt install firefox Reading package lists... Done Building dependency tree Reading state information... Done firefox is already the newest version (69.0+build2-0ubuntu0.18.04.1). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
You can also update all packages using GUI in your Ubuntu system. you can click Activities menu, and then type “updater” keyword in search box. press Enter key. and then click Software Updater icon.
Software Updater tool starts checking for updates. If there are packages that need to be updated, all updates will be listed. and you just need to click on the Install Now button. And If No packages need to be udpated, and you will see the following information box.
You should know that how to update/upgrade packages from the command line as well as to keep your packages on your system is up to date using the GUI in your Ubuntu Linux.