DGLOB(1)

πŸ’– DGLOB(1) β€” the Debian-goodies glow-up πŸ’–

okay bestie, pull up a chair, because dglob is one of those little tools that's lowkey iconic and nobody talks about it enough. it lives in the Debian-goodies family (that's the manual section it's filed under, iykyk) and it's about to become your new fave. ✨


✨ NAME ✨

dglob β€” expand package names or files matching a pattern πŸŽ€


🌸 SYNOPSIS 🌸

dglob [-a] pattern

dglob [-0] -f pattern

πŸ¦‹ DESCRIPTION πŸ¦‹

so basically: dglob lists package names that match a substring pattern. that's the whole vibe. and if you want, it can also list all the files those packages contain. it's giving "find but for packages." πŸ’…

by default dglob only searches installed packages β€” like, the ones actually on your machine. the -a and -n switches widen that search (scroll down to OPTIONS, bestie, i got you). the list gets written to stdout, one name per line. clean. tidy. slay.

grep-dctrl(1) and grep-aptavail(1) are the ones doing the actual searching through the package list, so if you wanna know exactly how patterns get matched, go read their docs. no cap. by default, every package whose name contains the string you gave gets matched β€” but there's a whole lil arsenal of options to change that behavior (again: OPTIONS). 🫢

now, if you use dglob with the -f option, instead of package names you get all the files inside the matched packages. and here's the important part, don't skip it:

  • if you do NOT use the -a switch, only existing, plain files get listed β€” meaning no symlinks, no directories, no other special file types. just plain ones. πŸ’€
  • if you do use the -a switch, then all files get listed, both for installed and non-installed packages.

the filenames go to stdout, one file per line. and if you want them separated by '\0' instead of a newline? that's what the -0 option is for. πŸŽ€


πŸ’… OPTIONS πŸ’…

dglob supports the following options β€” every single one, no skips:

  • -a β€” search through all available packages, not just the installed ones. if this is set, grep-aptavail(1) gets used. πŸ‘‘
  • -A β€” do not emit architecture qualifiers on the result. bye bye :amd64, basically.
  • -n β€” search through all the available packages but not including the installed ones. if set, grep-aptavail(1) is used. (yes it's the "everything except what i already have" girlie.)
  • -f β€” list all files in the matched packages. by default this only lists installed (i.e. locally existing) files from installed packages. if you use it together with -a, then it lists all files β€” both from installed and non-installed packages β€” by means of apt-file(1).
⚠️ real talk: if apt-file isn't installed, then using -f together with -a is, and i quote, "rather pointless." so maybe install it first, bestie. 😭
  • -0 β€” when listing files (with -f), use '\0' as the separator instead of a newline. and when you specify this without -f? it does absolutely nothing. zero. nada. it's just vibing there. πŸ™ˆ
  • -r, -e, -i, -X, -v β€” these get passed directly to grep-dctrl(1) or to grep-aptavail(1) to modify how the pattern is matched. see grep-dctrl(1) for the deets. ✨

πŸ”₯ EXAMPLES πŸ”₯

okay this is the part where it all clicks. watch:

$ dglob libc6
libc6-dbg:amd64
libc6:amd64
libc6:i386
libc6-i386:amd64
libc6-dev:amd64

see how it just knew? next:

$ dglob libc6:amd64
libc6-dbg:amd64
libc6:amd64
libc6-i386:amd64
libc6-dev:amd64

and with the :all architecture qualifier, iconic behavior:

$ dglob zsh:all
zsh-syntax-highlighting:all
zsh-theme-powerlevel9k:all
zsh-doc:all
zsh-common:all
zsh-antigen:all
fizsh:all

now the -n girlie β€” everything except installed:

$ dglob -n libc6:i386
libc6-amd64-dbgsym:i386
libc6-amd64:i386
libc6-dbg:i386
libc6-dev-amd64:i386
libc6-dev-x32:i386
libc6-dev:i386
libc6-pic:i386
libc6-x32-dbgsym:i386
libc6-x32:i386
libc6-xen:i386

and finally, -a piped into wc -l because we love counting our blessings (and our packages):

$ dglob -a :amd64 | wc -l
45846
$ dglob -a :i386 | wc -l
45185
$ dglob -a :all | wc -l
28995

numbers. gorgeous. 🌈


πŸ“ FILES πŸ“

  • /var/lib/dpkg/status β€” the dpkg(8) status file, which serves as the source for the list of available and installed packages. it's literally the main character of this whole operation. πŸ‘‘

πŸ‘‘ AUTHORS πŸ‘‘

  • Matt Zimmerman <mdz@debian.org>
  • Axel Beckert <abe@debian.org>

this manpage was written by Frank Lichtenheld <frank@lichtenheld.de>, and further enhanced by Javier Fernandez-Sanguino <jfs@debian.org>. absolute legends, all of them. 🫢


Copyright (C) 2001 Matt Zimmerman <mdz@debian.org>.

this program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.

on Debian systems, a copy of the GNU General Public License version 2 can be found in /usr/share/common-licenses/GPL-2.


🌈 SEE ALSO 🌈

grep-dctrl(1), grep-available(1), apt-file(1), dpkg(8)


and that's the tea, bestie πŸ’– this page came to you courtesy of perl v5.40.1 and the date 2025-12-06 β€” go forth and glob, you absolute icon. πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from