The update command in Linux is used to synchronize package index files from their sources defined in /etc/apt/sources.list or /etc/apt/sources.list.d/ with the latest versions available. This makes sure that your system has the most up-to-date information about available packages and their versions, enabling you to install or upgrade software packages efficiently.
Syntax of the update command in Linux
sudo apt-get update' or 'sudo apt update
- sudo: Runs the command with administrative privileges.
- apt-get or apt: Package management tool for Debian-based systems.
- update: Specific command to refresh package index files.
Commonly Used Options in the ‘update’ command in Linux
Options
| Description
|
---|
--show-upgraded
| Shows a list of packages available for upgrade.
|
---|
--quiet
| Operates in quiet mode, reducing the amount of output.
|
---|
-assume-yes
| Automatically answers yes to prompts and runs non-interactively.
|
---|
Practical Examples of Update Command in Linux
Below are some of the practical examples of the update command in Linux with the utilization of various additional options along with the command.
1. Update Package List with Showing Upgradable Packages
Command:
sudo apt update --show-upgraded
Explanation:
In this example, the command is used to refresh the package list and display packages that are available for upgrade. This helps users identify which packages can be updated to their latest versions, making sure that system software is up-to-date with the latest improvements and security fixes.
Output:

2. Update Package List Quietly
Command:
sudo apt update --quiet
Explanation:
In this example, the command is used to update the package list in quiet mode, reducing the amount of output displayed in the terminal. This is useful for users who want to perform updates without verbose information, making the process less intrusive and easier to read.
Output:

3. Update Package List Non-interactively
Command:
sudo apt update --assume-yes
Explanation:
In this example, the command is used to update the package list without any interactive prompts. It automatically answers yes to all prompts, allowing for a non-interactive update process. This is useful for automated or scripted updates where manual confirmation is not desired.
Output:

Conclusion
In conclusion, the update command in Linux is important for keeping your system's package index files synchronized with the latest versions, ensuring efficient software installation and upgrades. By using options like --show-upgraded, --quiet, and --assume-yes, users can customize the update process to suit their needs, whether it's identifying upgradable packages, reducing output verbosity, or running non-interactively for automation purposes.
Similar Reads
RPM Command in Linux The RPM (Red Hat Package Manager) command is a fundamental tool in the world of Linux package management. It is widely used in Red Hat-based distributions like Fedora and CentOS, as well as other RPM-based distributions. The RPM command allows users to install, query, verify, and manage software pac
6 min read
How to Run Patch Command in Linux? Sometimes, you install software by compiling it from source code instead of using package managers like yum or apt-get. When a security fix is available for such software, you can't just upgrade it like you normally would. Instead, you must download the security patch, apply it to the source code, a
9 min read
YUM Commands for Linux Package Management If you are a Linux user or system administrator, chances are you've come across YUM (Yellowdog Updater, Modified) at some point in your journey. YUM is a powerful package management tool that simplifies the process of installing, updating, and managing software on Red Hat-based Linux distributions l
5 min read
Pacman command in Arch Linux Pacman is a package manager for the arch Linux and arch-based Linux distributions. If you have used Debian-based OS like ubuntu, then the Pacman is similar to the apt command of Debian-based operating systems. Pacman contains the compressed files as a package format and maintains a text-based packag
4 min read
How To Update Jenkins In Linux? Jenkins is known as open-source software that is popularly used for the automation of the server, it is widely used for building and deploying applications on an enterprise level, so if you are using the Jenkins software for production and its deployment, it is very important to make sure that the J
6 min read