← 返回命令列表

Linux command

apt-file 命令

安全

权限或系统影响较大,执行前请核对目标。

常用示例

Update

sudo apt update

Search

apt-file search [path/to/file]

List

apt-file show [package]

Example

apt-file search -x [regex]

说明

apt-file searches for files in apt packages, including packages that are not yet installed. This is useful for finding which package provides a specific file or command.

参数

search, find pattern
Search for packages containing files matching pattern
show, list package
List the contents of a specific package
update
Update the package contents cache (usually via apt update)
-x, --regexp
Treat pattern as a regular expression
-l, --package-only
Only show package names, not file paths
-F, --fixed-string
Do not treat pattern as a regex (faster)
-i, --ignore-case
Case-insensitive search
-a, --architecture arch
Search for a specific architecture
-D, --dummy
Run without taking action (used for testing)
-N, --non-interactive
Do not prompt for input; suitable for scripts

FAQ

What is the apt-file command used for?

apt-file searches for files in apt packages, including packages that are not yet installed. This is useful for finding which package provides a specific file or command.

How do I run a basic apt-file example?

Run `sudo apt update` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does search, find pattern do in apt-file?

Search for packages containing files matching pattern