How to Find Exact Name of A Package by Using apt-cache in Linux?

How to Find Exact Name of A Package by Using apt-cache in Linux?

 

This post was last updated on August 1st, 2020 at 10:53 pm

In a debian based package management system the apt-cache is a low-level tool to manipulate and obtain information about packages from apt’s internal database. It creates a repository of information about the packages that are available from your source list. Apt’s database gets updated when you run apt update command.

Let’s say you want to install the Google Chrome web browser from your terminal but you don’t know the exact name of the package that can be used to install it. First, open your terminal by using ctrl+alt+t and then execute the following command –

sudo apt-cache search google-chrome

And this would return a list of packages available that refer to the word google-chrome. Now you can choose the right one to install in your system.

What are other operations that can be performed with apt-cache?

By using apt-cache you can perform various operations on apt’s internal database some of them are given below-

  1. apt-cache showsrc package-name
    To display all the source package records that match with the given package name use the above command
  2. apt-cache showpkg package-name
    To display the information for packages listed on the command line it will show dependencies, reverse dependencies, etc
  3. apt-cache stats
    To display the statics of cache it includes information such as total package name, total package structure, etc execute the above command
    No further arguments are required with this command
  4. apt-cache dump
    To display information of cache in the terse form use the above command
  5. apt-cache unmet
    The above command will display all unmet dependencies of packages
    You can also check it for a specific package by adding the package name as the argument to this command.
  6. apt-cache show package-name
    To display the readable record for a given package use the above command
  7. apt-cache search package-name
    As discussed above to search the exact name of a package use the search command as given below
    It will search and display a list of packages matching with the given pattern
  8. apt-cache depends package-name
    To display all the dependencies a package has and all the other package that can fulfill those dependencies
  9. apt-cache rdepends package-name
    To display all the reverse dependencies that a package has, execute the above command
  10. apt-cache pkgnames
    To display the name of all packages that apt know execute the above command
  11. apt-cache dotty package-name
    Use the above command to find the co-relation and dependency between different packages.
    The dotty takes a list of packages in the command line and generate package graphs that are used by dotty from Graphviz. The output of this command will be a set of nodes and edges representing the relationship between the packages.

Is there any other way to find the exact name of a package?

Apart from using apt-cache, you can also use the aptitude command to find the exact name of a package. It will display a list of packages containing the given pattern. We will again search for the same package i.e. a web browser program as we do with apt-cache command. Execute the following command in your terminal-
aptitude search google-chrome

Now, look at the screenshot given below-

On the left column of the response we have got, you see i, p, etc. where i indicates the programs that are already installed in the system and p represents the programs that are available for installation.

Well, this is the benefit of using aptitude which gives the information of whether a program is installed or not. But comparatively, it is slower than the apt-cache search command.

Now if you know any other way to do so or if you have a query or suggestion on improving this topic then let us know by writing in the comments section.

Previous [FreeBSD] How to install ports collection manually in FreeBSD
Next What Is aptitude And How To Use It?
 

About author

You might also like

How To 0 Comments

How To Set JAVA_HOME Environment Variable For All Users In Linux?

This post was last updated on August 1st, 2020 at 12:51 pmAn environment variable is a variable whose value is set outside the program, Typically through a functionality built into

Linux Topics 0 Comments

How To Create An ISO Image In Linux Using Terminal?

This post was last updated on August 1st, 2020 at 10:18 pmIso image files are distributed as a single downloadable file for bootable OS, games, etc. It is important to

Linux Topics 0 Comments

Using Sed, A Stream Editor In Linux/Unix

This post was last updated on August 3rd, 2020 at 02:42 pmSed stands for stream editor It was based on the scripting feature of ed(a line based interactive text editor

0 Comments

No Comments Yet!

You can be first to comment this post!

Leave a Reply