Search for packages in Ubuntu using the apt search
At times, you would need to know if a certain package is available to be installed on your system or not. The apt search command helps in such cases.
To install a package, knowing the exact name of the package is necessary.
Such as to install apache in Ubuntu, you can not use sudo apt install apache
. You will have to specify the apache2
instead of plain apache
.
And I have encountered many errors like this and that's why I came up with this guide so you don't have to.
How to search packages in Ubuntu
The basic syntax to search packages using apt search is as follows:
apt search package_name
For example, here, I am looking for a package named Nala, an apt frontend. So I will be using the following command:
apt search nala
But by default, the apt will search for the keyword in the package name and description.
So it gets unnecessary packages included in search queries.
And in that case, you can use the --names-only
flag:
apt search --names-only package_name
As you can see, the search results are cut in half making it easy to find the necessary package.
Once you know the name of the package, you can the traditional sudo apt install
to install a package:
sudo apt install package_name
It's that easy!
But what if you want to know additional information about the package? Well, I've got you covered!
Get additional information about the package in Ubuntu
By default, the apt search command gets you a brief description of the package but if you want to know more, you can use the show
option:
apt show package_name
While there is a huge list, I find the listing of the following to be crucial:
- Package version
- Dependencies
- Download and installed size
- Description
Wrapping Up
This was a quick tutorial on how you can search packages using apt. And if you want to have more options to search packages, you can use apt-cache on Ubuntu and Debian-based distros.
For queries and suggestions, feel free to leave comments.