dlocate - program to view debian package information
dlocate [option...] [command]
dlocate is a fast alternative to dpkg for queries like dpkg -L
and dpkg -S
.
- pattern...
-
List all records where either the package name or the filename matches pattern.
Note that dlocate is written in Perl and uses Perl regular expressions, so regexp metacharacters need to be taken into account or avoided by using the -F or --fixed-strings option.
Also note that regexp patterns often need to be quoted or escaped to prevent the shell from trying to expand them.
For example, to search for
/usr/bin/[
, you might try:dlocate '/usr/bin/\['
or
dlocate -F '/usr/bin/['
- -S filename...
-
List all records where only the filename matches the filename pattern.
Perl regexp-enhanced emulation of
dpkg -S
.Note that dlocate is written in Perl, so regexp metacharacters need to be taken into account.
For example, to search for
/usr/bin/[
, you need to type:dlocate '/usr/bin/\['
Or use the -F or --fixed-strings option
dlocate -F '/usr/bin/['
- -P package...
-
List all records where only the package name matches the pattern.
- -l package...
-
Perl regexp-enhanced emulation of
dpkg -l
. Shows all packages which match package.Internally this searches a file containing the reformatted output of
dpkg -l
(four fields separated by tabs; status, package-name, installed version, short description) so, unlikedpkg -l
it will return packages whose version or short description matches, too.All searches use Perl regular expressions by default. Fixed strings can be used instead by using the -F or --fixed-strings option.
Note that because of the difference between regular expressions and dpkg's shell-style pattern matching, the output from
dlocate -l
is occasionally different to the output fromdpkg -l
.This is not a bug, regular expressions are far more flexible than shell pattern matching. This is the way dlocate is supposed to run, but it may require some knowledge of regular expressions to get the output you want.
Regular expressions may need to be quoted on the command line to avoid being expanded by the shell.
- -k
-
List package names of installed kernels and all related packages.
Optionally takes a regexp pattern argument to list only matching kernels. For example,
dlocate -k 6.10
, orapt-get purge $(dlocate -k '6.12.(8|11)')
to purge all kernel-related packages for versions 6.12.8 and 6.12.11 - -K
-
Detailed list of installed kernels and all related packages. Optionally takes a regexp pattern argument to list only matching kernels.
- -L package...
-
List all files in package.
The output order is preserved from the one used by dpkg-query, which preserves the order from the .deb archive, where symlinks are provided at the end to guarantee they point to already unpacked entries in the filesystem.
- -s package...
-
Print status of package.
- --ls package...
-
ls -ldF
of all files in package. - --lsconf package...
-
ls -ldF
of conffiles in package. - --conf package...
-
List conffiles in package.
- --du package...
-
du -sck
of all files in package. - --md5sum package...
-
List md5sums (if any) of package.
- --md5check package...
-
Check md5sums (if any) of package.
- --man package...
-
List man pages (if any) in package.
- --lsman package...
-
List full path/filenames of man pages (if any) in package.
- --lsbin package...
-
List full path/filenames of executable files (if any) in package.
- --lsdir package...
-
List only the directories in package.
- --changelogs package...
-
View the changelogs in package with
sensible-viewer
. If combined with the -f or --filenames-only option will instead output the list of changelog files in package.
- -a architecture, --arch architecture
-
Limit search to packages for one architecture. For example,
dlocate -L libxcursor -a i386
- -I, --installed-only
-
Show only installed packages in output.
- --zero, -z, -0
-
Use NUL-separated output for all commands and options except <B><--du>
- -f, --filename-only
-
Only output file names when searching for files.
- -p, --package-only
-
Only output package names when searching for files.
- -w, --word-regexp
-
Select only those lines containing matches that form whole words. The test is that the matching substring must either be at the beginning of the line, or preceded by a non-word constituent character. Similarly, it must be either at the end of the line or followed by a non-word constituent character. Word-constituent characters are letters, digits, and the underscore.
- -i, --ignore-case
-
Ignore case distinctions in the pattern.
- -F, --fixed-strings
-
Interpret pattern... as a list of fixed strings (with all metacharacters escaped via perl's quotemeta() function), any of which will match.
- -h, --help
-
Display help message and exit.
- -V, --version
-
Display dlocate's version number and exit.
- -v, --verbose, --debug
-
Produce verbose debugging output.
- -c, --columns[=columns]
-
Set columns width to override the dlocate default of using the entire terminal line width. Any value for columns less than 80 will be increased to 80.
- -C, --colour, --color
-
Colourise -l or -s output (requires supercat to be installed).
- /etc/default/dlocate
-
Configuration file with default options. Currently the only option is to enable/disable gzip or zstd compression of /var/lib/dlocate/dlocatedb.
- /var/lib/dlocate/dlocatedb
-
Plain text listing of all files belonging to all packages. This file may optionally be compressed with either gzip or zstd.
- /var/lib/dlocate/dpkg-list
-
Listing of all packages known to dpkg.
See update-dlocatedb(8) for details.
To find which package /usr/bin/[
belongs to:
dlocate '/usr/bin/\['
To view all man pages contained within the dpkg package:
man $(dlocate -man dpkg)
To purge kernel versions 6.10.10 and 6.10.11, including -image, -headers and -kbuild packages.
apt-get purge $(dlocate -k 6.1[01])
or
dlocate -0 -k 6.1[01] | xargs -0r apt-get purge
To check the md5sums of the dlocate package:
dlocate --md5check dlocate
To run dpkg-repack
on all installed packages where the package name matches xserver:
dpkg-repack $(dlocate -I -P -p xserver)
or
dlocate -I -P -p xserver -0 | xargs -0r dpkg-repack
dlocate does not update its databases (see FILES section) automatically after new or upgraded packages have been installed with dpkg or apt-get etc.
A daily cron job is run to perform the update. Or the root user can run update-dlocatedb at any time to force an update.
- COLUMNS
-
Sets the number of columns dlocate should use when displaying formatted text. Currently only used by -l. Values lower than 80 are increased to 80.