How Do I Search for Available Packages From Command-Line in Linux?
Have you struggled to search for available packages that are available for installation? This guide will provide you with the exact answers you are looking for.
In Linux systems, you need a package name for the installation and removal of a package. While searching, you will need the exact name of the package you are looking for. If you don’t know the package name, you can search for a package by just inserting a keyword (description/name) related to it.
Considering the importance of this fact, this post offers methods to search for installed packages on the Linux command line.
How to Search For Available Packages in Debian/Ubuntu-Based Linux Distributions?
There are several ways of searching for a package in Debian, Linux Mint, and Ubuntu. This section will cover the apt, and apt-cache. Before moving towards the commands for search it is recommended to update your package repository.
To do that launch your terminal and run the following command:
sudo apt update
This command is used to download the information of a package from all available configured sources.
To get the list of all available packages in Ubuntu run this command:
sudo apt list
This command will list all the available and installed packages.
sudo apt list --installed
apt list --upgradeable
How to Search For Available Packages in CentOS/Redhat-Based Linux Distributions?
To search for a package in CentOS or Redhat, you have to use the yum package manager with the list option to list the packages, i.e., available, installed, all, and kernel.
Update the System Packages:
Before moving forward with searching available packages, open the terminal and run the check-update command to get updates:
After getting updates run the update command to update all installed packages by using the update command:
To get the list of available packages on CentOS/RedHat, you can use the following command:
yum list available
Apart from that, you can use the following commands to get the list of a specific category of packages:
yum list installed
yum list kernel
yum list all
How to Search For Available Packages in Fedora-Based Linux Distributions?
Like yum in CentOS/RedHat, the official package manager in Fedora is dnf. The dnf offers more or less the same functionality as yum. The suitable dnf command options are listed below to use dnf to list the packages:
Update the Packages List:
Before starting check for updates and update the already installed packages by using the following commands:
Now, use the “update or upgrade” option to update the packages list:
To get the List of Available Packages on Fedora, use the following command:
dnf list --available
Similarly, for the list of installed, all, and kernel packages, use the “–installed”, “–all”, and “–kernel” options with the “dnf list” command.
How to Search For Packages in Arch Linux?
Pacman package manager is an Arch Linux-based manager. It is made with the combination of a binary package management system and easy to build package system. The pacman does not directly list the available packages. However, you can list the installed packages using the command:
Note: Use the “sudo” keyword or log in as the root user if the root permissions are required.
Each distribution of Linux offers its package manager that can be used to search the packages through the terminal. For instance, to search for available packages in Ubuntu, use the apt and for CentOS/RedHat and Fedora, use yum and dnf. This guide has covered the ways to list the available packages in the Linux command line.
For more tips and tricks on Linux, keep visiting LINUX GENIE.