How to search for available packages from the command line in Debian, Ubuntu or Linux Mint [APT]

There are multiple ways to search for packages available in Debian, Ubuntu or Linux Mint from the command line. In this article, I will introduce apt, apt-cache with aptitude. Use it to search the package name and package description, if you want to find a specific package but don’t know the exact package name, or if you need a tool for a specific purpose / task, you can use this function without knowing what is available Options.
The main difference between use apt, apt-cache with aptitude As shown in the example below, searching for available software packages is their output and sort order. and also, aptitude It may not be installed by default on Debian-based Linux distributions.
I personally prefer apt-cache Because the output is easier to read (and I usually do n’t need additional information-check out the installed / available versions I can use apt-cache policy package-name); It also tends to show the results I am looking for near the top.
Another thing to note is apt with apt-cache Search the apt package cache so that they return the packages available in the repository and the manually installed DEB packages (not available in the repository), and aptitude Only return packages available in the repository. Use aptitude to search for available packagesaptitude Is a front end based on Ncurses apt. Usually this tool is not installed by default, but you can install it in Debian, Ubuntu, Linux Mint and other Debian-based Linux distributions using the following command:

sudo apt install aptitude

You can use aptitude to search for packages from the command line as follows:

aptitude search KEYWORD

example:

$ aptitude search openssh

p   libconfig-model-openssh-perl                           - configuration editor for OpenSsh                                
p   libghc-crypto-pubkey-openssh-dev                       - OpenSSH key codec  
p   libghc-crypto-pubkey-openssh-dev:i386                  - OpenSSH key codec  
v   libghc-crypto-pubkey-openssh-dev-0.2.7-6af0a           -                    
v   libghc-crypto-pubkey-openssh-dev-0.2.7-6af0a:i386      -                    
p   libghc-crypto-pubkey-openssh-doc                       - OpenSSH key codec; documentation                                
p   libghc-crypto-pubkey-openssh-prof                      - OpenSSH key codec; profiling libraries                          
p   libghc-crypto-pubkey-openssh-prof:i386                 - OpenSSH key codec; profiling libraries                          
v   libghc-crypto-pubkey-openssh-prof-0.2.7-6af0a          -                    
v   libghc-crypto-pubkey-openssh-prof-0.2.7-6af0a:i386     -                    
p   libnet-openssh-compat-perl                             - collection of compatibility modules for Net::OpenSSH            
p   libnet-openssh-parallel-perl                           - run SSH jobs in parallel                                        
p   libnet-openssh-perl                                    - Perl SSH client package implemented on top of OpenSSH           
p   lxqt-openssh-askpass                                   - OpenSSH user/password GUI dialog for LXQt                       
p   lxqt-openssh-askpass:i386                              - OpenSSH user/password GUI dialog for LXQt                       
p   lxqt-openssh-askpass-l10n                              - Language package for lxqt-openssh-askpass                       
v   lxqt-openssh-askpass-l10n:i386                         -                    
i   openssh-client                                         - secure shell (SSH) client, for secure access to remote machines 
p   openssh-client:i386                                    - secure shell (SSH) client, for secure access to remote machines 
p   openssh-client-ssh1                                    - secure shell (SSH) client for legacy SSH1 protocol              
p   openssh-client-ssh1:i386                               - secure shell (SSH) client for legacy SSH1 protocol              
p   openssh-known-hosts                                    - download, filter and merge known_hosts for OpenSSH
p   openssh-server                                         - secure shell (SSH) server, for secure access from remote machines
p   openssh-server:i386                                    - secure shell (SSH) server, for secure access from remote machines 
p   openssh-sftp-server                                    - secure shell (SSH) sftp server module, for SFTP access from remote machines
p   openssh-sftp-server:i386                               - secure shell (SSH) sftp server module, for SFTP access from remote machines

If you want, you can also use the aptitude Ncurses UI. Types of aptitude Start it:

You can press to search for packages / Then start typing keywords. Use to search for available packages apt-cache
Adopt apt-cache Let’s search for packages available in Debian, Ubuntu or Linux Mint repositories (and installed DEB packages that are not in the repo) as follows:

apt-cache search KEYWORD

example:

$ apt-cache search openssh

openssh-client - secure shell (SSH) client, for secure access to remote machines
openssh-server - secure shell (SSH) server, for secure access from remote machines
openssh-sftp-server - secure shell (SSH) sftp server module, for SFTP access from remote machines
python-setproctitle - Setproctitle implementation for Python 2
python3-setproctitle - Setproctitle implementation for Python 3
ssh - secure shell client and server (metapackage)
agent-transfer - copy a secret key from GnuPG's gpg-agent to OpenSSH's ssh-agent

...

ssh-askpass-gnome - interactive X program to prompt users for a passphrase for ssh-add
ssh-audit - tool for ssh server auditing
sshpass - Non-interactive ssh password authentication

I deleted some output because it would become very long. Although the order of visible results has not changed. Use to search for available packages apt
To use apt You can search for available packages from the command line as follows:

apt search KEYWORD

Replace KEYWORD with the keyword you want to search (you can add multiple keywords in quotes).
This is an example of searching for “openssh” and its output:

$ apt search openssh

Sorting... Done
Full Text Search... Done
agent-transfer/bionic 0.41-1ubuntu1 amd64
  copy a secret key from GnuPG's gpg-agent to OpenSSH's ssh-agent

cme/bionic,bionic 1.026-1 all
  Check or edit configuration data with Config::Model

connect-proxy/bionic 1.105-1 amd64
  Establish TCP connection using SOCKS4/5 or HTTP tunnel

...

openssh-client/bionic,now 1:7.6p1-4 amd64 [installed]
  secure shell (SSH) client, for secure access to remote machines

openssh-client-ssh1/bionic 1:7.5p1-10 amd64
  secure shell (SSH) client for legacy SSH1 protocol

openssh-known-hosts/bionic,bionic 0.6.2-1 all
  download, filter and merge known_hosts for OpenSSH

openssh-server/bionic 1:7.6p1-4 amd64
  secure shell (SSH) server, for secure access from remote machines

openssh-sftp-server/bionic 1:7.6p1-4 amd64
  secure shell (SSH) sftp server module, for SFTP access from remote machines

putty-tools/bionic 0.70-4 amd64
  command-line tools for SSH, SCP, and SFTP

python-scp/bionic,bionic 0.10.2-1 all
  scp module for paramiko

I deleted some results again because the list of results is very long. The order of results has not changed.
For these three, the search results can be very long. In this case, you can moreFor easy reading, for example:

apt-cache search KEYWORD | more

You can also use the following method to exclude results that do not contain a specific keyword (KEYWORD2 in this example) grep:

apt-cache search KEYWORD | grep KEYWORD2

grep By default, it is case sensitive. Add -i (grep -i KEYWORD2) Ignore case.

Source

Sidebar