How do I update Ubuntu using terminal command line

I am a new Ubuntu Linux user. I need to update Ubuntu Linux, but do not have GUI installed on my AWS/Google cloud server. How do I update Ubuntu using terminal? How can I upgrade Ubuntu using terminal command line?

Introduction: Ubuntu Linux is a free and open source operating system based on GNU userland and Linux kernel. Ubuntu is well known for ease of use. It is popular on both desktop and servers. One can update Ubuntu Linux using terminal bash shell. This page shows how to upgrade Ubuntu using terminal session.

How do I update Ubuntu using terminal?

  1. Open the terminal application
  2. For remote server use the ssh command to login (e.g. ssh user@server-name)
  3. Fetch update software list by running sudo apt-get update command
  4. Update Ubuntu software by running sudo apt-get upgrade command
  5. Reboot the Ubuntu box if required by running sudo reboot

Let us see all commands in details.

How do I upgrade Ubuntu using terminal?

You need to use either apt command or apt-get command. The apt command provides a high-level command line interface for the package management system. One can install new packages, update packages, remove/delete packages and performer other sysadmin duties for package management using apt.

How to sync the package index files from their sources via Internet

Run the command:
$ sudo apt-get update
$ sudo apt update

How to install the newest versions of all installed packages on Ubuntu

Execute the command:
$ sudo apt-get upgrade
$ sudo apt upgrade

You may need to reboot the Linux server if kernel was updated:
$ sudo reboot

How to update already installed package named nginx

The syntax is:
$ sudo apt install PackageNameHere
Alternatively, you can use the following syntax too:
$ sudo apt-get install PackageNameHere
Let us upgrade nginx package:
$ sudo apt install nginx
If nginx package is already installed it will try to update to latest version:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
nginx is already the newest version (1.10.3-0ubuntu0.16.04.2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.


You learned how to update or upgrade Ubuntu Linux using terminal based session.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 0 comments... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
0 comments… add one

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum