How to find package name with terminal

  7 years ago

1. apt-cache

The apt-cache command line tool is used for searching apt software package cache.

To list all the available packages, type this command:

$ apt-cache pkgnames

You can pipe the output of this command to less or more

$ apt-cache pkgnames | less

$ apt-cache pkgnames | more

Less allows you to scroll from within even a non-scrollable terminal, more prints a page then you press enter to bring up every line after that.

To find out the package name and  it's description, use the "search" flag.

For example, you can search for gnome-mines.

$ apt-cache search gnome-mines

This is the output:

gnome-mines - popular minesweeper puzzle game for GNOME
gnomine - popular minesweeper puzzle game for GNOME (transitional package)

To display all packages starting with word "fire" ( you can use whatever) type:

$ apt-cache pkgnames fire



If you want to display package version number, check sums, size, installed size, category... use show:

$ apt-cache show firefox

To check dependencies for specific packages use showpkg.

$ apt-cache showpkg firefox

The stats sub command will display overall statistics about the cache.

$ apt-cache stats


2. aptitude

You can use ncurses  interface or search through cli.
To run aptitude with ncuses interface:

$ aptitude

Seaching with CLI:

This lists all avaiable packages.

$ aptitude search ~T | less

p -package is not installed

c -the package was deleted but its configuration files remain on the system

i -installed packages

v -virtual packages

A -package was automatically installed

This lists installed packages:

$ aptitude search ~i | less

This matches any package which is purely virtual: that is, its name is provided by a package or mentioned in a dependency, but no package of that name exists.

$ aptitude search ~v | less

This  matches any installed package which can be upgraded

$ aptitude search ~U | less

Lists all firefox packages:
$ aptitude search firefox | less

This will list all packages containing word "fire":

$ aptitude search fire | less

This will list all installed packages containing word "fire":

$ aptitude search ~ifire | less

To display detailed information about package use show flag.

& aptitude show firefox


To install software packages follow this tutorial:

misko_2083 7 years ago

I've added basic aptitude search. Thanks for reminding me about aptitude's CLI omurad.

omurad 7 years ago

"aptitude search [XXX]" also works.