+3 votes
38 views
apt cache command

in Linux/Unix by (551k points)
reopened | 38 views

1 Answer

+4 votes
Best answer

How to use the apt-cache command in Linux

To stay up to date, remember to subscribe to our YouTube channel!
SUBSCRIBE ON YOUTUBE

 

In Linux we find a large group of commands with which it is possible to perform various support and information tasks, one of these very useful commands is apt-cache, which you will see how to use within this complete tutorial to manage the cache of the system..

 

The apt-cache command is in charge of doing an analysis and showing the available information about the packages that are installed in the system as well as what can be installed, its work is exclusively based on the data stored in the local cache when the “update” parameter is used.

 

 

parameters
Some of the parameters that we can use with apt-cache are:

 

  • showsrc: is in charge of displaying the font information.
  • search: its task is to search the list of packages using the regular expression pattern that we indicate.
  • depends: Generates available dependency information for the package.
  • rdepends – View reverse dependency information for the package.
  • show – Displays a readable log for the selected package.
  • pkgnames: Creates a list of the names of all the packages on the system.
  • policy.: allows us to see the policy parameters of a package.

 

 

There are some options to use and TechnoWikis will show you how to access these details..

 

How to use the apt-cache command in Linux

 

Step 1

For this case we will use Ubuntu but the process is similar in the other distributions, we open the terminal and we can use the following command to search for all the packages associated with that name:
 sudo apt-cache search (name) 
image

 

Step 2

We go to the bottom to see all the results. There we see that each line is related to the name of the searched package.

 

image

 

Step 3

Now we can use the following command to list the name of all packages without a description:
 sudo apt-cache pkgnames 
image

 

Step 4

Again we go to the bottom to see the other results:

 

image

 

step 5

To see fewer results, or use summary mode, we run the following command:
 sudo apt-cache pkgnames | them 
step 6

By pressing the Enter key you can see more results. To exit press the q key.

 

 

image

 

step 7

If desired, it is possible to filter the results for a particular package, in this case use the following command:
 sudo apt-cache pkgnames | grep(name) 
step 8

There we find all the packages related to that name.

 

 

image

 

step 9

To access all the details of the package, we will use the following command:
 sudo apt-cache show (name) 
image

 

step 10

There we find details such as:

 

  • package name
  • type of architecture
  • current version
  • origin
  • developer
  • associated processes
  • local path
  • SHA1 verification
  • size and more details

 

 

step 11

If we want to see the dependencies of a package we will execute the following:
 sudo apt-cache showpkg(name) 
image

 

step 12

In order to see the general statistics of the cache we will use the following command:
 sudo apt-cache stats 
image

 

step 13

We see the total number of packages by their type as well as the size of each section. We can see the details of a package installation with the following command. We see if the package is installed or not, its candidate to use, version and more.

 

image

 

So apt-cache is an ally when it comes to working with this type of packages in Linux.

 


by (3.5m points)
edited

Related questions

+5 votes
1 answer
asked Oct 15, 2019 in Linux / Unix by backtothefuture (551k points) | 337 views
+5 votes
1 answer
asked Oct 13, 2023 in Linux/Unix by backtothefuture (551k points) | 33 views
+3 votes
1 answer
asked Sep 13, 2023 in Linux/Unix by backtothefuture (551k points) | 41 views
+5 votes
1 answer
+5 votes
1 answer
asked Jul 27, 2023 in Linux/Unix by backtothefuture (551k points) | 41 views
Sponsored articles cost $40 per post. You can contact us via Feedback
10,634 questions
10,766 answers
510 comments
3 users