I have successfully installed some packages using the command line 'sudo apt-get install packagename' when I have known in advance that those packages are available. But how can I search for or get a list of what is available in the repositories?
I have successfully installed some packages using the command line 'sudo apt-get install packagename' when I have known in advance that those packages are available. But how can I search for or get a list of what is available in the repositories?
To search for a particular package by name or description:
From the command-line, use:
where the search keyword can be all or part of a package name or any words used in its description.
For example,
apt-cache search proxy
includes both these packages:To get a list of ALL packages
Use Synaptic if you have X-forwarding enabled or are on a desktop
Synaptic is often a more convenient way to do this, but requires at least an X server on your end (unless you're running a desktop environment). Install with
sudo apt-get install synaptic
if necessary.Synaptic on ssh'd server via X forwarding:
Synaptic running locally on Ubuntu Desktop:
Using
aptitude
,apt-cache
, andapt
all format the output differently. (None of these require the use ofsudo
when searching for a package.) I prefer usingapt
for its readability. It highlights the package name and puts a space between the different packages. It also has[installed]
listed next to each package that is already installed. Usage:You can also use aptitude from the command line:
To find out the package name and with it description before installing, use the ‘search‘ flag. Using “search” with apt-cache will display a list of matched packages with short description. Let’s say you would like to find out description of package ‘vsftpd‘, then command would be.
Assuming you want to do all of this from the terminal use the following:
first I recommend you update the package index files so the list of all files in the repository you are about to create is up to date
then use "search regex" function in
apt-cache
where "regex" stands for Regular Expression and is the pattern given to search. For more info about search patterns you can look up manual regex(7) by commandman 7 regex
or in English. A regex variable equal to . will suffice.The above will give you ALL the results but it is not in any order that is particularly helpful for browsing.
So finally we can sort by dictionary order using
sort -d
and show only a page at a time usingless
.Unfortunately I don't have enough rep to add this a comment on the main answer.
But I was trying to find
g++-
- alike packages withapt-cache search
. It's important to know in this case thatkeyword
is a regular expression soapt-cache search g++-
will not have helpful results.apt-cache search "g[+][+][-]"
would be the way to goapt list <package>
is how I recommend searching for packages. If you don't get any matches or if you're not sure what the package is named, try wrapping the argument in asterisks to get more results. For instanceapt list *chrome*
will yield the following:Alternatively, if you'd like a description of each package, run
apt search --names-only <package>
. Make sure to include--names-only
for more accurate results.The OP aimed only to
apt
, which was already answered (apt search
). Some people might end up here searching for solutions for other (more modern) alternatives.Nowadays we have other sources for apps:
pip
,brew
,flatpak
andnpm
, to name a few popular ones. All of them also works withsearch
subcommand.You could handle all of the above and others with
meta-package-manager
, which solves XKCD #1654 (don't look #927)."Extended variant" is useful in case of excessive number of results:
Example of searching for ssh server package if I do not know the name is ssh-server or sshserver or server-ssh etc.:
Steps to prepare
apt-file search
for searching. It should be done before first usage: