0% found this document useful (0 votes)
14 views10 pages

How Do I Update Ubuntu Using Terminal?

Uploaded by

dpe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views10 pages

How Do I Update Ubuntu Using Terminal?

Uploaded by

dpe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

nixCraft → Howto → Ubuntu Linux → How do I update Ubuntu using terminal command

line

How do I update Ubuntu using terminal


command line
Author: Vivek Gite Last updated: July 6, 2024 12 comments

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 all installed Ubuntu apps using terminal session.
Tutorial details
Difficulty level Easy
Root privileges Yes
Requirements Linux terminal
Category Package Manager
OS compatibility Debian • Mint • Pop!_OS • Ubuntu • WSL
Est. reading time 3 minutes

How do I update Ubuntu using terminal?


1. Open the terminal application
2. For remote server use the ssh command to login. For example:ssh user@server-
name
3. Fetch update software list by running the sudo apt-get update command
4. Update Ubuntu software by running the sudo apt-get upgrade command
5. 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
You can list available upgrades as follows:

apt list -a --upgradable


You will see it as follows:

Listing... Done
tzdata/focal-updates,focal-updates 2024a-0ubuntu0.20.04.1 all [upgradable
from: 2024a-0ubuntu0.20.04]
tzdata/focal-security,focal-security,now 2024a-0ubuntu0.20.04 all
[installed,upgradable to: 2024a-0ubuntu0.20.04.1]
tzdata/focal,focal 2019c-3ubuntu1 all

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


OR
sudo 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

This entry is 6 of 13 in the Debian/Ubuntu apt-get Tutorial series. Keep reading the rest of the
series:

1. Ubuntu 18.04 update installed packages for security


2. How Do I Update Ubuntu Linux Softwares Using Command Line?
3. Ubuntu Linux: Upgrade Linux Kernel
4. Ubuntu Enable & Setup Automatic Unattended Security Updates
5. Linux: Update All Packages Command
6. How do I update Ubuntu using terminal command line
7. Debian upgrade or update a single package using apt-get
8. Ubuntu upgrade or update a single package using apt-get
9. How do I see what packages are installed on Ubuntu Linux?
10. What does sudo apt-get update command do on Ubuntu/Debian?
11. Ubuntu Linux – How Do I install .deb Packages?
12. apt-get hold back packages on Ubuntu / Debian Linux
13. Ubuntu 20.04 LTS update installed packages for security

� Was this helpful? Please add a comment to show your appreciation or feedback.

Hi! �
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open
source. Subscribe to my RSS feed or email newsletter for updates.
Related Tutorials
 How To Update macOS Using Command Line Software Update Tool

 gnome-terminal: There Was An Error Creating The…

 How To Update Fedora Linux using terminal for latest…

 Mac OS X: Delete SSH Keys Using Terminal Command Line

 How To Upgrade FreeBSD 6.2 to FreeBSD 6.3 ( Minor…

 Update FreeBSD Using Proxy Server (csup / portsnap…

 FreeBSD update packages and apply security upgrades…

Category List of Unix and Linux commands


Check version • Fedora • FreeBSD • Linux • Ubuntu 18.04 • Ubuntu •
Ansible
macOS
Archiving z commands
Category List of Unix and Linux commands
Backup
Debian/Ubuntu • FreeBSD • RHEL
Management
Backup MySQL server • MariaDB Galera cluster • MariaDB TLS/SSL •
Database Server
MariaDB replication • MySQL Server • MySQL remote access
Download
wget
managers
Driver
Linux Nvidia driver • lsmod
Management
Documentation help • mandb • man • pinfo
Disk Management df • duf • ncdu • pydf
File Management cat • cp • less • mkdir • more • tree
Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 •
Firewall
Ubuntu 18.04 • Ubuntu 20.04 • Ubuntu 24.04
KVM
CentOS/RHEL 7 • CentOS/RHEL 8 • Debian 9/10/11 • Ubuntu 20.04
Virtualization
Linux Desktop
Chrome • Chromium • GIMP • Skype • Spotify • VLC 3
apps
Backups • CentOS/RHEL • Debian 11 • Fedora • Mount dir • Ubuntu
LXD
20.04 • Ubuntu 22.04
Modern utilities bat • exa
Network Monitoring tools • Network services • RHEL static IP • Restart network
Management interface • nmcli
Network Utilities NetHogs • dig • host • ip • nmap • ping
CentOS 7 • CentOS 8 • Debian 10 • Debian 11 • Debian 8/9 • Ubuntu
OpenVPN
18.04 • Ubuntu 20.04
Power
upower
Management
Package Manager apk • apt-get • apt • yum
Processes bg • chroot • cron • disown • fg • glances • gtop • iotop • jobs • killall •
Management kill • pidof • pstree • pwdx • time • vtop
Searching ag • egrep • grep • whereis • which
Shell builtins compgen • echo • printf
System
reboot • shutdown
Management
Terminal/ssh sshpass • tty
Text processing cut • rev
Text Editor 6 Text editors • Save and exit vim
User Environment exit • who
groups • id • lastcomm • last • lid/libuser-lid • logname • members • users
User Information
• whoami • w
User Management /etc/group • /etc/passwd • /etc/shadow • chsh
Web Server Apache • Let's Encrypt certificate • Lighttpd • Nginx Security • Nginx
Category List of Unix and Linux commands
Alpine • Amazon Linux • CentOS 8 • Debian 10 • Firewall • Ubuntu
WireGuard VPN
20.04 • qrencode
12 comments… add one

 Imogen Mar 13, 2022 @ 12:35

Helped a lot with my Ubuntu 18.04 AWS pro server. Thank you.

↩∞

 leilaB Apr 4, 2022 @ 6:50

Very simple to the point and helpful. Thanks :D

↩∞

 MasKoko May 9, 2022 @ 23:58

I use these command line:

sudo apt update && sudo apt upgrade && sudo apt full-upgrade && sudo
apt dist-upgrade && sudo apt-get check && sudo apt -f install && sudo
apt -y clean && sudo apt -y autoclean && sudo apt autoremove && sudo
dpkg --configure -a && sudo apt --fix-broken install

↩∞

 Raquel May 30, 2022 @ 15:17

Thank you so much.


I was having a hard time connecting a second monitor with HDMI , and using theses
commands simply solved it:

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.

p.s. im a freshly fresh newbie ;)

↩∞

 Lionel Jul 14, 2022 @ 4:25

Very helpful

↩∞

 Kenny Millar Jan 24, 2023 @ 14:21


This does not upgrade Ubuntu – just some optional packages

↩∞

o � Vivek Gite Apr 10, 2023 @ 19:14

No, it upgrades all installed packages, such as Linux kernel, bash, and gnome
apps. Are you looking to upgrade your OS next release? Maybe see how to
upgrade Ubuntu 20.04 to 22.4 page: https://www.cyberciti.biz/faq/upgrade-
ubuntu-20-04-lts-to-22-04-lts/

↩∞

 Linx Apr 10, 2023 @ 18:33

Thankyou so much for detailed tutorial.

↩∞

 Danny Aug 7, 2023 @ 21:05

Thank you

↩∞

 Anonymous Mar 20, 2024 @ 19:18

Hi
I tried this on my Chromebook, and it deleted all my Linux files and refused to start. It
says Penguin Not Found.
DO NOT TRY ON CHROMEBOOKS!

(By the way, You should have tried this on a virtual Chrome OS to test that this works
or not)

↩∞

o � Vivek Gite Mar 20, 2024 @ 19:36

Are you using Ubuntu on your Chromebook? The ChromOS is Linux based
but it does not allow to run Linux command directly. This has nothing to do
with Ubuntu.

↩∞

 don Jul 6, 2024 @ 1:24

great info for old farts thanks

↩∞
Leave a Reply

Your email address will not be published. Required fields are marked *

Comment *

Name

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site admin.

Next FAQ: How to change root password on Fedora Linux

Previous FAQ: How to change theme in Ubuntu 16.04/17.10

🔥 FEATURED ARTICLES

 1

30 Cool Open Source Software I Discovered in 2013

 2

30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X

 3

Top 32 Nmap Command Examples For Linux Sys/Network Admins

 4

25 PHP Security Best Practices For Linux Sys Admins

 5

30 Linux System Monitoring Tools Every SysAdmin Should Know

 6

40 Linux Server Hardening Security Tips

 7

Linux: 25 Iptables Netfilter Firewall Examples For New SysAdmins


 8

Top 20 OpenSSH Server Best Security Practices

 9

Top 25 Nginx Web Server Best Security Practices

 10

My 10 UNIX Command Line Mistakes

👀 /etc

 ➔

Linux shell scripting tutorial

 ➔

RSS/Feed

 ➔

About nixCraft

©2002-2024 nixCraft • Privacy • ToS • Contact/Email • Corporate patron Cloudflare

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy