How to search for ubuntu packages

How to Search for Ubuntu Packages

Ubuntu is an open-source operating system. It offers users full flexibility, allowing them to add custom packages to their system. Often, we have a problem locating the packages installed on our system or looking for the ones to install. So in this article, we will walk through the process of package location on Ubuntu. We will also go over the list of problems that may arise during your search and how to ward them off. So without further ado, let us delve into it.

Listing packages on Ubuntu.

As stated before, Ubuntu is an open-source operating system. That means it has various third-party applications developed by the community to aid in various problems we may face in day-to-day life. One such problem may be package detection. These packages can be detected via tools like Synaptic package manager. However, the most commonly used are apt and apt-get commands.

The
Sponsored
apt confusion.

First and foremost, we distinguish between apt, aptitude, and apt-get commands. Both deal with linking the Debian management system to the available online repositories. We can think of aptitude as a neural center that is used when we need to see a detailed view of all the packages on our system. APT (Advanced Packaging Tool) is the main command for installing, removing, or managing packages. A package manager embodies various apt commands like apt-get, apt show, apt-cache, etc.

Using the apt command.

To list the packages available on our system, we type in the following command.

$ apt list

How to search for ubuntu packages 1

As shown below, we can filter out a class of packages by adding certain modifications to our list command.

See also  How to Install Synopsysctl on Linux Using 5 Easy Steps
$ apt list | grep package_name

We may come across a warning stating: WARNING: apt does not have a stable CLI interface. Use caution in scripts.

The warning dictates the variable nature of apt, which is not happening any time soon. So it is not a big deal.

However, we can instead type if we wish to be on the safe side without the warning appearing.

$ dpkg–list | grep package_name

Which deals with the on-disk installation like on windows.

The command illustrated above shows us the installed packages and additional packages that can be installed. However, we can type if we only wish to view the packages installed on your system.

$ apt list –installed

How to search for ubuntu packages 2

Determine if a package is installed or not.

We can look up if a certain package is installed on our system or not by using the following command.

$ apt list -a package_name

How to search for ubuntu packages 3

The commands mentioned above clearly show that acpid is installed. In the second case, the listing was done; however, we did not find the desired package. That means the package is unavailable on our list and will have to be installed via the main package repository.

When a package is installed, we can clearly see the “[installed]” on the same lines as the package names on the terminal, as shown in the images above.

List packages in sorted order.

To list packages in a pattern, we can use the following set of commands.

How to search for ubuntu packages 4

Sponsored

Here “ii” indicates installed packages, whereas “un” indicates uninstalled packages.

Sort packages by date and time of installation.

To sort packages according to the date and time of installation, we simply issue the following command.

$ zgrep “installed”/var/log/dpkg.log*

How to search for ubuntu packages 5

If we want to look for all packages pertaining to a particular keyword, we use the following instruction.

$ apt-cache search KEYWORD | grep certain_keyword

Or

$ apt search keyword

How to search for ubuntu packages 6

Possible issues encountered during package search.

We may encounter several problems while locating the desired package. These include problems regarding package location or version issues. We will address them one by one.

Unable to locate package error. This error occurs when we download a package that can’t be located. This is the most common error encountered that may arise for several reasons and hamper your installation.

How to search for ubuntu packages 7

  • Error due to incomplete package name. We may have typed in the incorrect package name by mistake. Make sure NOT to repeat or omit the alphabets and keep in mind that Ubuntu is case-sensitive. We also make sure to provide a proper name with the version desired.
  • Error due to incomplete path. This error may arise when we try to download the package directly after downloading the .deb package. Please ensure we are in the right directory and provide the absolute path to the .deb package. That should resolve the issue.
  • Error due to missing package. It is possible that the package under search is not yet available in the official Ubuntu package directory. We can verify using the apt-cache command. If the package does not pop up, that means we need to download it manually via a third party.
  • /etc/apt/sources.list is corrupted or missing. When none of the packages we try to install are installed, it is most likely this error. We first delete the /etc/apt/sources.list file using the following command to resolve this.
$ sudo rm –rf /etc/apt/sources.list

Then run.

See also  Discover the future of Autonomous Mobile Robots (AMR) with Canonical and Husarion at ROSCon 2023
$sudo software-properties-gtk

In the window that appears, check all boxes, and in the “download from” section, select the main server. Then close.

How to search for ubuntu packages 8

Afterward, we get a warning window. We click the “reload” option to generate the sources.list file.

After the software cache refreshes, your issue should be resolved ad the package will be downloaded.

How to search for ubuntu packages 9

How to search for ubuntu packages 10

As we can see, the package causing the error is now successfully downloaded.

Your Linux version has reached its limit. In case your version is obsolete and not supported, we can use third-party versions or snap versions of packages to run desired applications.
How to search for ubuntu packages 11

Conclusion.

In this article, we went through the stages of package location and how to tackle the problems that may arise during the process. We hope we could clear your queries and your issue has been resolved successfully.


Discover more from Ubuntu-Server.com

Subscribe to get the latest posts sent to your email.

Comments

No comments yet. Why don’t you start the discussion?

    Leave a Reply