apt-file is a command line tool for
searching files in packages for the APT package management system.
Some actions are required to run the search:
Resynchronize the package contents from their sources. The
lists of the contents of packages are fetched from the location(s)
/etc/apt/sources.list. This command
attempts to fetch the
Contents-<ARCH>.gz files from
remote sources. For downloading these uses either the curl or
wget commands as specified in apt-file.conf.
Search in which package a file is included. A list of all
packages containing the pattern pattern
apt-file will only search for filenames, not directory names.
This is due to the format of the Contents files it searches.
Alias for search.
List the contents of a package matching the
pattern pattern. This action is very
close to the dpkg -L command except the
package does not need to be installed or fetched.
Alias for list.
remove all Contents-*
files from the cache directory.
--cache | -c cache-directory
Sets the cache directory to cache-directory
instead of its default. If executed as non-root user, the default
is $HOME/.cache/apt-file with fall-back to
/var/cache/apt/apt-file. The latter is also
the default if apt-file is called as root.
--verbose | -v
Run apt-file in verbose mode.
--cdrom-mount | -d cdrom-mount-point
Use cdrom-mount-point instead of
--non-interactive | -N
Skip schemes that are listed in the interactive line in
This is useful if you want to call 'apt-file update' in cron jobs and skip all
schemes that may require user input.
--ignore-case | -i
Ignore case when searching for pattern.
--regexp | -x
Treat pattern as a (perl) regular expression. See
perlreref(1) for details. Without this option,
pattern is treated as a literal string to search
--version | -V
Show version number.
--architecture | -a architecture
Sets architecture to architecture. This
option is useful if you search a package for a different
architecture from the one installed on your system.
It determines how the $ARCH variable
in sources.list is expanded (but it does not influence
the search in any other way).
--sources-list | -s sources.list
Sets the sources.list file to a
different value from its default
--package-only | -l
Only display package name; do not display file names.
--from-file | -f
Read patterns from the given file(s), one per line.
Use -f - for stdin.
This is much faster than invoking apt-file many times.
--from-deb | -D
Use contents of the given .deb archives(s) as patterns.
Useful for searching for file conflicts with other packages.
--fixed-string | -F
Do not expand search pattern with generic characters at
pattern's start and end.
--dummy | -y
Run in dummy mode (no action).
--help | -h
Display a short help screen.
The apt-file configuration file can
be found in /etc/apt/apt-file.conf.
A string expansion is done on several values. See the string
This variable describes how cached files will be named.
http | ftp | ssh | rsh | file | cdrom
Defines the commands used to fetch files.
A sources.list entry is defined as:
deb uri dist component1 component2 ...
A uri is defined as:
replace with the hostname
replace with the port number
replace with full uri
replace with full path (relative to / on the host)
Non-release lines in sources.list are not handled by apt-file.
There is only one Contents file per distribution that contains all
components (i.e. main, contrib, and non-free). Threrefore, apt-file will
display search results from all components, even if not all components
are included in the sources.list file.
When a new line has been added to the sources.list and apt-file update has
not been run, apt-file does not print a warning message.
Complex regular expressions that match the leading slash may not work
correctly. As a workaround, try to pull the leading slash to the beginning
of the regular expression. For example, use "/(usr/bin/vim|sbin/lvm)"
instead of "/usr/bin/vim|/sbin/lvm".