32

How do I get the prosaic description of a package using apt? I tried both apt-cache show and apt-cache showpkg but no luck.

Using synaptic it's easy as typing the package name and the description is given by the standard view, but sometimes I'd prefer to just use apt-cache, for example from terminal.

N.N.
  • 18,219
Paolo
  • 1,776
  • 8
    apt-cache show shows the package description int the Description: field. What else are you looking for? – enzotib Jun 19 '11 at 20:56
  • 3
    "apt-cache show " shows the Description if the package is known to the system. In what way is it not working for you? – Flimzy Jun 19 '11 at 20:56
  • @enzotib I oversighted the output. apt-cache show does exactly the thing I asked for. – Paolo Jun 19 '11 at 21:07

6 Answers6

23

If you would just use apt-cache search package-name, all packages with "package-name" in it would be returned. To limit to a package named "package-name", use:

apt-cache search ^package-name$
Lekensteyn
  • 174,277
  • strange, for example apt-cache search ^vim$ doesn't only find the vim package, but some more, but not all, that apt-cache search ^vim finds ??? – rubo77 Mar 30 '17 at 08:10
  • 1
    @rubo77 apt-cache search ^vim$ also lists other packages like vim-gtk because that package provides the vim package. You can check that with apt-cache show vim-gtk. – Lekensteyn Mar 30 '17 at 12:12
  • so with an extra grep you can narrow the result to only the package: http://askubuntu.com/a/898398/34298 – rubo77 Mar 30 '17 at 19:20
  • Regarding your comment from 30 mar 2017 at 12:12, the regex ^..$ does not list other packages, only one between the regex delimiters. – Timo May 04 '22 at 09:56
11

You can do this with aptitude as in:

aptitude show package-name

See also Is aptitude still considered superior to apt-get?

N.N.
  • 18,219
  • 1
    This is almost the same as apt show, check with eg colordiff -y --suppress-common-lines <(apt-cache show feh) <(aptitude show feh) – Pablo Bianchi Jan 13 '20 at 04:52
8

apt-cache show <packagename> does what you want. You might have overseen it. The following command highlights it:

apt-cache show scons | grep --color -E "Description|$"
Martin Thoma
  • 19,277
5

Lekensteyn answer is great to get the short description. Extending Martin's answer you can get also the larger multi-line description (also in other languages):

apt-cache show figlet toilet | grep -E "^Package|^Description-en|^ "

If you use this a lot you can add this function to your .bashrc/.zshrc:

apt-desc() { apt-cache show "$@" | grep -E "^Package|^Description-en|^ "; }

For a normal case just use the friendlier apt show.

Pablo Bianchi
  • 15,657
4

Assuming you are looking for a specific package, I believe the following is what you are in search of:

apt-cache search some-pkg

If I have misunderstood what you are trying to do, please let me know.

Lekensteyn
  • 174,277
Kory Wnuk
  • 1,501
1

Strange, for example apt-cache search ^vim$ doesn't only find the vim package, but some more, but not all, that apt-cache search ^vim finds.

So better use this:

PACKAGE=vim
apt-cache search ^$PACKAGE$|egrep "^$PACKAGE -"
rubo77
  • 32,486