Find packages with apt-cache and aptitude

When uninstalling a program or package in Linux, you have two options, or do it through the program center of your distro, or from a terminal.

To uninstall a program from the command line, you need to know the exact name of the package. And it turns out that sometimes, this gets hard to remember. It may happen that when you want to uninstall a program, you are only uninstalling a package or dependency on it. This post will help you to get a package or program through a terminal with apt-cache y aptitude.


The apt-cache command will allow you to observe a lot of information about the packages stored in the APT database.. We can define this information as a cache, which is temporarily stored once the apt-update command is executed, to update the APT database.

Let's start by checking all the packages installed on your distro. If you run:

apt-cache pkgnames | more

A list will be generated with all the packages available in the system. By placing “| more ”allows you to scroll through the list by line by pressing Enter. In the case of wanting to move up and down with the keyboard or scroll arrows, you can execute

apt-cache pkgnames | less

to exit the list of packages, just press the letter "q".

Knowing part of the name

It's certainly a bit rudimentary to look for a package on a list that seems timeless. For this particular example, we will work by searching for the handbrake-gtk program

In case you know the beginning of the package name you can run:

apt-cache pkgnames

The command will return a list of all packages whose names begin with the name entered above.

That is, if you only remember "hand", when executing the command, you would have something like this.

Now suppose you know a part of the program name, but not necessarily the start. In this case, we will use the aptitude command. If you run the following command:

aptitude search

Aptitude, performs a search in the APT database, and lists all the packages whose name contains the chunk you defined earlier. For example, if you only remembered "brake", you would get something like this.

In either case, whether you know the start of the program or not, you can always use the aptitude command to locate a package.

Once the package is obtained, you can obtain all the information about it from the terminal. Running:

apt-cache depends


Show all dependencies of the package. If you want to show more information about the package specifications, such as name, size, dependencies, size once installed and more, you can use the show command by executing.

apt-cache show

You can always read the apt-cache manual by running

man apt-cache

To check any other utility commands.

The content of the article adheres to our principles of editorial ethics. To report an error click here!.

2 comments, leave yours

Leave a Comment

Your email address will not be published. Required fields are marked with *



  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   TheGuillox said

    Interesting ... I use the command "sudo apt search" to search for a package in the repositories.

  2.   HO2Gi said

    Very good, and I just realized that I have millions of software packages that I test, good post.
    To use VBox from now on XD.