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.

ADVERTISEMENTS

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
OR
$ sudo apt update

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

Execute the command:
$ sudo apt-get upgrade
OR
$ sudo apt upgrade
How do I update Ubuntu using terminal command
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.

Conclusion

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

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig 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 jobs killall kill pidof pstree pwdx time
Searchinggrep 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

ADVERTISEMENTS
0 comments… add one

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.