How to Use “apt search” command in Ubuntu 22.04?

The apt is a command-line tool to manage the packages on Linux distributions used for different purposes. The apt package works with the core repositories that contain thousands of packages for Debian-based distributions. It offers a variety of commands, one of which is the “apt search” command. The “apt search” command searches for a package in the repository.

In this guide, we will discuss how to use the “apt search” command in Ubuntu 22.04 using different search commands.

How to Use the “apt search” Command in Ubuntu 22.04?

The apt search command helps to find the installed versions, dependencies, and details of the packages in ubuntu 22.04. We can find the installed packages only and available packages with their dependencies using the apt search command. Let’s discuss the command using examples.

How to Search a Package in apt Package Manager?

The apt-package manager contains thousands of packages used for various purposes. If you want to check about a specific package, its general syntax is as follows:

$ sudo apt search <package-name>
How to install Kali Linux in Window...

In this scenario, the “ansible” package is being searched using the “apt search” command:

$ sudo apt search ansible

The output shows a detailed list of the “ansible” package alongside its dependencies.

Apart from the list of dependencies, you can only search for the packages except for their dependencies. Like, the command below will list only the file that contains the “ansible” in its name. To do so, the command is piped with the “grep” command:

$ apt search ansible | grep ansible

Similarly, one can search and filter the results as per their requirement.

Bonus Tip: Search a Package in apt-cache

The apt-cache is a command-line tool to collect information about the packages and search for the available versions in Debian-based systems. To search the package’s dependencies and libraries from the apt-package manager, use the “sudo apt-cache search <package-name>” command. Like, the below command will search a package named “ansible” in the “apt-cache”:

$ sudo apt-cache search ansible

That’s the end of this guide!


The “apt search” command is used to search the libraries and dependencies of a package from the apt-package manager. The users may utilize the “sudo apt search <package-name>” command to search for a specific package in the apt-packages list, or they can use the “sudo apt-cache search <package-name>” command to search from the apt-cache. This post has provided a detailed guide about using the “apt search” command in Ubuntu 22.04.