How to Search Available Packages in Ubuntu from the Command Line?

Available packages refer to the collections of software that can be available on a system to add new functionality or update existing software. They typically include software components, libraries, documentation, and configuration files. Searching available packages are finding and installing software packages for a specific task or application. This can help save time and effort compared to manually downloading and installing packages.

This article will explain different methods to search available packages in Ubuntu using the command-line interface (CLI):

Method 1: Using “apt-cache search” Command

The “apt-cache search” command is a simple and widely used way to search for available packages. For instance, the following command will search for packages containing the word “python3.11“:

$ sudo apt-cache search python3.11

The output shows the list of available packages that is matched with the “python3.11

Method 2: Using “apt search” Command

The “apt search” command works similarly to “apt-cache search” but with a more modern syntax. In our case, specify the package “java” to check the availability in Ubuntu by utilizing the “apt search” command:

$ sudo apt search java3

The output shows the available packages that are matched with the “java3” in the command line.

Method 3: Using “apt list” Command

The “apt list” command lists all the packages available in the system. Pipe the output to the “grep” command to search the packages. For instance, specify the “python3” package to check the availability:

$  apt list | grep python3

The output enlisted the number of packages matched with the string “python3” in the terminal.

Method 4: Using “dpkg -l” Command

The “dpkg” command with the “l” option lists the specific packages that are available on the system with more details, including the “package name”, “version”, “architecture”, and “description”. For instance, “python3” is searched out via the “grep” command:

$ sudo dpkg -l | grep python3

The above command shows the list of available packages in the terminal that is matched with the word “python3”.

Conclusion

Ubuntu offers the “apt-cache search”, “apt search”, “apt list”, and “dpkg” commands to search available packages from the command line. These commands provide users with a convenient and efficient way to install, manage, and update software. This article has explained different methods to search available packages in Ubuntu via the command line.