How to find a package starting with a given string at packages.ubuntu.com?
I was trying to find a package named libkf5kjs-dev
. Now I know the exact name of the package, but when I went to the search page at packages.ubuntu.com
I only knew that it started with the string libkf5
. If I type this into the keyword field:
and press "Search"
, I get a lot of results but none of them matches
libkf5kjs-dev
. What am I missing here? How should I search to get the correct package?
Web interface
If you look closely you will see a message:
Your keyword was too generic, for optimizing reasons some results might have been suppressed.
Please consider using a longer keyword or more keywords.
search for libkf5k
and you’ll find libkf5kjs-dev
.
The reason
Since these kind of queries can easily be used to run DoS like attacks to the databases they’re not supported by the web interface.
CLI
You can also use command line to search for packages specifically for your Ubuntu version (using regex):
$ apt-cache search --names-only ^libkf5 | grep js | grep dev
libkf5jsembed-dev - Embedded JS library for Qt
libkf5kjs-dev - Support for JS scripting in Qt applications
Running the “libkf5” search keyword on packages.ubuntu.com returns:
Your keyword was too generic, for optimizing reasons some results
might have been suppressed. Please consider using a longer keyword or
more keywords.
It looks like the website has an upper limit on the number of search results. I would suggest using apt-file
(install using sudo apt install apt-file
) instead to return all possible results:
$ apt-file search libkf5 | grep libkf5kjs-dev
libkf5kjs-dev: /usr/share/doc/libkf5kjs-dev/changelog.Debian.gz
libkf5kjs-dev: /usr/share/doc/libkf5kjs-dev/copyright
libkf5kjs-dev: /usr/share/lintian/overrides/libkf5kjs-dev
where you can see that libkf5kjs-dev
can be found.
If you don’t mind opening a ~1.2MB webpage, the full list of packages of a given release can be viewed on https://packages.ubuntu.com. For example: https://packages.ubuntu.com/xenial/allpackages?format=txt.gz
Then, just use your browser search feature.
If you don’t mind including everything in your source.list
, globbing with something like this could work:
apt list "libkf5*"
apt search
will include package description, which sometimes is not wanted:
list - list packages based on package names search - search in package descriptions show - show package details install - install packages reinstall - reinstall packages remove - remove packages autoremove - Remove automatically all unused packages update - update list of available packages upgrade - upgrade the system by installing/upgrading packages full-upgrade - upgrade the system by removing/installing/upgrading packages edit-sources - edit the source information file satisfy - satisfy dependency strings