/ factorpad.com / tech / linux-essentials / apt-cache-command.html
An ad-free and cookie-free website.
Beginner
Learn to search for packages and dependencies at the Linux command line.
Videos can also be accessed from the Linux Essentials Playlist on YouTube.
Linux apt-cache Command Summary with Examples (4:00)
Our sixty-sixth word, or command to memorize is
apt-cache
from our category
System.
apt-cache
allows you to search for
packages and dependencies.
-options | description |
---|---|
-h ,
--help |
Print help screen |
-n ,
--names-only |
Search the name field only |
Recall from the last video on
apt-get
we saw online repositories
and apt-cache
will help us find what
packages are available.
Before we start, it helps to think of commands as mini programs and
most follow this structure:
command -option(s) argument(s)
.
The apt-cache
command has
23 options and the argument can be a search term like
a software package name. There are also, let's call them, sub-commands
and an example is entered like this:
apt-cache [-options] search package name
.
Like most commands, help is available with double-dash
--help
. The
-n
option used in searches only
accesses the name field, instead of the description (field).
Make note, separate commands apply to two types of Linux
distributions, Debian-style is apt-cache
,
here, and in Fedora it's yum
.
So why is apt-cache
an important command?
Well, you need a way to find out what you're missing out on, well at
least in your Linux life.
And now you know how to do that.
Okay, the best way to embed this in your memory is by typing in your own terminal window.
Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows.
Here we go. Start with a
stats
of the local cache file
downloaded in our last apt-get update
.
And it has over 50,000 package names. Impressive huh?
Next, I'll do a search for the word
nano
, a text editor we know about,
and then pipe it to a word count, for lines that is, to see both how
many are out there in both the name and description fields, then just
the name fields only. And this will take a second to show up and
code up here, so bear with me.
Okay, very good, you can see each one there, description fields with names (23) and then also names only (16). We narrowed our search (from 50,000+ package names), so let's see the 16 name field results.
And there they all are.
Nano, nano, nano ;) (Mork and Mindy, haha)
And last, let's use
showpkg
for details on this package
nano
.
Okay now you know how to use apt-cache
.
And you know the syntax for commands, options and arguments.
One last tip about the apt-cache
command. So the command helps resolve when packages are dependent on
other packages. So read up on that.
Okay, thanks for visiting today. I hope this was a helpful
introduction to the apt-cache
command.
For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:
Help keep this free from annoying ad banners and show your support with a YouTube Channel subscription. Also, for updates follow @factorpad on Twitter.
apt-get
command,
hit Back.aptitude
command, click Next./ factorpad.com / tech / linux-essentials / apt-cache-command.html
A newly-updated free resource. Connect and refer a friend today.