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

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 2 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
2 comments… add one
  • Tom Dec 23, 2008 @ 21:41

    You’ll want to run
    apt-get update
    apt-get upgrade
    frequently to keep the system up to date.

  • shashank sharma Sep 7, 2011 @ 21:51

    thanks for the info.. exactly what i was searching for

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum