How do I update Ubuntu using terminal?
- Open the terminal application
- For remote server use the ssh command to login. For example:ssh user@server-name
- Fetch update software list by running the sudo apt-get update command
- Update Ubuntu software by running the sudo apt-get upgrade command
- Finally, reboot the Ubuntu box by running the sudo reboot command.
Let us see all commands in details with examples.
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
First, open the terminal application. Then run the following command:sudo apt-get update
OR
sudo apt update
How to install the newest versions of all installed packages on Ubuntu
Next, execute the following command to apply package updates and patches:sudo apt-get upgrade
ORsudo apt upgrade
Sometimes a new Linux kernel is installed to fix security bugs at the kernel level. Hence, you may need to reboot the Ubuntu Linux server if kernel was updated. Issue the following shutdown command or reboot command for your cloud server or desktop. Before you reboot the box, note down Linux kernel version as follows:uname -r
Then:sudo reboot
After reboot again see new Linux kernel version, type uname command:
uname -r
How to update already installed package named nginx
Want to upgrade existing packages to fix security or other issues? No problem. The syntax is as follows:sudo apt install PackageNameHere
Alternatively, you can use the following syntax too:sudo apt-get install PackageNameHere
Now, 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 for all installed apps using the CLI. The apt command or apt-get command have many more options. Therefore, I suggest that you consult the following manual pages using the help command or man command:man apt
man apt-get
apt --help
Sources: https://www.cyberciti.biz/faq/upgrade-update-ubuntu-using-terminal/