Sunday, May 20, 2012

Debian / Ubuntu: Search For Packages Using Apt Command Line

Q. I've Debian 64 bit etch server installed. This box is managed via ssh or serial console only. There is no GUI installed. How do I search for packages using apt-get under Debian or Ubuntu Linux?

A. You can easily search for any packages using any one of the following tool.
a] apt-cache command : apt-cache performs a variety of operations on APT’s package cache. apt-cache does not manipulate the state of the system but does provide operations to search and generate interesting output from the package metadata.
b] aptitude command : aptitude is a text-based interface to the Debian GNU/Linux package system. It allows the user to view the list of packages and to perform package management tasks such as installing, upgrading, and removing packages. Actions may be performed from a visual interface or from the command-line.

apt-cache to search Debian / Ubuntu Linux Packages

Type the following command:
$ apt-cache search {package-name}
$ apt-cache search apache
$ apt-cache search 'web server'

Sample output:
aegis-web - aegis web based user interface
analog - analyzes logfiles from web servers
aolserver4 - AOL Web Server 4 (Program)
aolserver4-dev - AOL Web Server 4 (Development Tools)
aolserver4-doc - AOL Web Server 4 (Documentation)
aolserver4-nsldap - AOLServer 4 module for LDAP
apache2 - Next generation, scalable, extendable web server
apache2-mpm-prefork - Traditional model for Apache HTTPD 2.1
apache2.2-common - Next generation, scalable, extendable web server
araneida - A programmable web server written and extended in Lisp
aria - Tool to download files from the Internet via HTTP or FTP
awffull - web server log analysis program
...
....

aptitude to search new Debian / Ubuntu Linux Packages

You can search for new packages to install using Apt - the package manager. Using the search feature will output any packages that match the search criteria.
aptitude search {package-name}
aptitude search apache
aptitude search webserver

aptitude can also searches for packages matching one of the patterns supplied on the command line. All packages which match any of the given patterns will be displayed; for instance, following will list all new packages and all packages whose name contains edit:
aptitude search '~N' edit
See Debian Linux apt-get package management cheat sheet for further information.

Suggested readings:

  • aptitude and apt-cache man pages

No comments:

Post a Comment