Next: , Previous: , Up: Управление пакетами   [Contents][Index]

5.5 Invoking guix locate

There’s so much free software out there that sooner or later, you will need to search for packages. The guix search command that we’ve seen before (see Вызов guix package) lets you search by keywords:

guix search video editor

Sometimes, you instead want to find which package provides a given file, and this is where guix locate comes in. Here is how you can find which package provides the ls command:

$ guix locate ls
coreutils@9.1       /gnu/store/…-coreutils-9.1/bin/ls

Of course the command works for any file, not just commands:

$ guix locate unistr.h
icu4c@71.1          /gnu/store/…/include/unicode/unistr.h
libunistring@1.0    /gnu/store/…/include/unistr.h

You may also specify glob patterns with wildcards. For example, here is how you would search for packages providing .service files:

$ guix locate -g '*.service'
man-db@2.11.1        …/lib/systemd/system/man-db.service
wpa-supplicant@2.10  …/system-services/fi.w1.wpa_supplicant1.service

The guix locate command relies on a database that maps file names to package names. By default, it automatically creates that database if it does not exist yet by traversing packages available locally, which can take a few minutes (depending on the size of your store and the speed of your storage device).

Примечание: For now, guix locate builds its database based on purely local knowledge—meaning that you will not find packages that never reached your store. Eventually it will support downloading a pre-built database so you can potentially find more packages.

By default, guix locate first tries to look for a system-wide database, usually under /var/cache/guix/locate; if it does not exist or is too old, it falls back to the per-user database, by default under ~/.cache/guix/locate. On a multi-user system, administrators may want to periodically update the system-wide database so that all users can benefit from it, for instance by setting up package-database-service-type (see package-database-service-type).

Основной синтаксис:

guix locate [options…] file

... where file is the name of a file to search for (specifically, the “base name” of the file: files whose parent directories are called file are not matched).

The available options are as follows:


Interpret file… as glob patterns—patterns that may include wildcards, such as ‘*.scm’ to denote all files ending in ‘.scm’.


Display database statistics.


Update the file database.

By default, the database is automatically updated when it is too old.


Clear the database and re-populate it.

This option lets you start anew, ensuring old data is removed from the database, which also avoids having an endlessly growing database. By default guix locate automatically does that periodically, though infrequently.


Use file as the database, creating it if necessary.

By default, guix locate picks the database under ~/.cache/guix or /var/cache/guix, whichever is the most recent one.

-m method

Use method to select the set of packages to index. Possible values are:


This is the default method: it works by traversing profiles on the machine and recording packages it encounters—packages you or other users of the machine installed, directly or indirectly. It is fast but it can miss other packages available in the store but not referred to by any profile.


This is a slower but more exhaustive method: it checks among all the existing packages those that are available in the store and records them.

Next: Вызов guix gc, Previous: Пакеты со множественным выходом, Up: Управление пакетами   [Contents][Index]