An ad-free and cookie-free website.
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
apt-cache allows you to search for
packages and dependencies.
||Print help screen|
||Search the name field only|
Recall from the last video on
apt-get we saw online repositories
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).
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
-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
here, and in Fedora it's
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
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
Okay now you know how to use
And you know the syntax for commands, options and arguments.
One last tip about the
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
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-getcommand, hit Back.
aptitudecommand, click Next.
A newly-updated free resource. Connect and refer a friend today.