In this article we are going to show you how to use apt Command in Linux operating system. If you want to learn about apt command in Linux then this post is ideal for you.
Advanced Package Tool (APT) is a command-line utility that is used for installing, updating, Upgrading, removing, and managing deb packages on Ubuntu, Debian, and other related Linux distributions.
An APT repository is a local directory or network server or collection of deb packages with metadata that is readable by the APT tools.
With the help of APT repository, you can perform package install, removal, upgrade, and other operations on individual packages or groups of packages.
How to Use apt command in Linux Terminal
Update package index (apt update)
APT package index is a database that contains records of available packages from the repositories which are enabled on your system enabled in your system.
Run the command below to update the package index:
sudo apt update
The above command will pull the latest changes from the APT repositories. Always remember to update the package index before installing or upgrading new packages in your system.
Upgrade Packages (apt upgrade)
Run the command below to upgrade all the installed packages to their latest versions:
sudo apt upgrade
If you want to upgrade only a single package, run the below with the package name:
sudo apt upgrade package_name
Install packages (apt install)
Simply run the command below to install packages in you system :
sudo apt install package_name
Apt command also allows you to install multiple packages at once. To do that simply run the command below:
sudo apt install package_name1 package_name2
Remove Packages (apt remove)
Run the command below to remove or uninstall a package in your system:
sudo apt remove package_name
Replace package_name with the package you want to uninstall.
If you want to uninstall multiple packages in a single command then run the command below:
sudo apt remove package_name_1 package_name_2
If you want to completely remove package and its configuration settings file then run the command below :
sudo apt purge package_name
Remove Unused Packages(apt autoremove)
To remove the unused packages from your system, run the command below:
sudo apt autoremove
Listing Packages (apt list)
With help of list
command you can get list of the available, installed and upgradeable packages.
Run the command below to list all available packages:
sudo apt list
If you want to get the list of only installed packages on your system then run the command below:
sudo apt list --installed
Same as above, If you want to get the list of only upgradeable packages then run the command below:
sudo apt list --upgradeable
Package Information (apt show)
To get information about a given package, run the command below:
sudo apt show package_name
Searching Packages (apt search)
To search a package from the list of the available packages, run the command below:
sudo apt search package_name
That’s all.
If you find any error and issue in above steps , please use comment box below to report.