apt-file 的数据库文件存储在哪里?

apt-file 的数据库文件存储在哪里?

我想知道 apt-file 搜索到的数据库文件存储在哪里。

apt-file search /usr/bin/lshw-gtk

但是我没有看到 strace 显示的任何文件看起来像 apt-file 数据库文件。为什么会这样?

我看到上面说 apt-file 文件存储在/var/cache/apt/archives/下方。搜索这么多 deb 文件是不是太慢了?apt-file 是否使用一些缓存文件来加快搜索速度?

$ time apt-file search /usr/bin/lshw-gtk
lshw-gtk: /usr/bin/lshw-gtk               

real    0m0.542s
user    0m0.361s
sys 0m0.358s

apt-get 文件存储在哪里?

$ strace -e trace=open,openat apt-file search /usr/bin/lshw-gtk
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libcrypt.so.1", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/dev/urandom", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/bin/apt-file", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/perl-base/strict.pm", O_RDONLY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/perl-base/warnings.pm", O_RDONLY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/perl-base/constant.pm", O_RDONLY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/perl-base/warnings/register.pm", O_RDONLY|O_CLOEXEC) = 5
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/perl-base/Getopt/Long.pm", O_RDONLY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/perl-base/vars.pm", O_RDONLY|O_CLOEXEC) = 5
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/perl-base/Exporter.pm", O_RDONLY|O_CLOEXEC) = 5
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/perl-base/overload.pm", O_RDONLY|O_CLOEXEC) = 5
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/perl-base/overloading.pm", O_RDONLY|O_CLOEXEC) = 6
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/perl-base/Exporter/Heavy.pm", O_RDONLY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/perl-base/File/Basename.pm", O_RDONLY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/perl5/5.32/AptPkg/Config.pm", O_RDONLY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/perl5/5.32/AptPkg.pm", O_RDONLY|O_CLOEXEC) = 5
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/perl-base/DynaLoader.pm", O_RDONLY|O_CLOEXEC) = 5
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/perl-base/Config.pm", O_RDONLY|O_CLOEXEC) = 6
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/perl5/5.32/auto/AptPkg/AptPkg.so", O_RDONLY|O_CLOEXEC) = 5
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 5
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libapt-pkg.so.6.0", O_RDONLY|O_CLOEXEC) = 5
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = 5
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 5
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libresolv.so.2", O_RDONLY|O_CLOEXEC) = 5
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libz.so.1", O_RDONLY|O_CLOEXEC) = 5
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libbz2.so.1.0", O_RDONLY|O_CLOEXEC) = 5
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/liblzma.so.5", O_RDONLY|O_CLOEXEC) = 5
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/liblz4.so.1", O_RDONLY|O_CLOEXEC) = 5
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libzstd.so.1", O_RDONLY|O_CLOEXEC) = 5
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libudev.so.1", O_RDONLY|O_CLOEXEC) = 5
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libsystemd.so.0", O_RDONLY|O_CLOEXEC) = 5
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libgcrypt.so.20", O_RDONLY|O_CLOEXEC) = 5
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libxxhash.so.0", O_RDONLY|O_CLOEXEC) = 5
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/librt.so.1", O_RDONLY|O_CLOEXEC) = 5
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libgpg-error.so.0", O_RDONLY|O_CLOEXEC) = 5
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/perl5/5.32/AptPkg/hash.pm", O_RDONLY|O_CLOEXEC) = 5
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/perl-base/Scalar/Util.pm", O_RDONLY|O_CLOEXEC) = 6
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/perl-base/List/Util.pm", O_RDONLY|O_CLOEXEC) = 6
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/perl-base/XSLoader.pm", O_RDONLY|O_CLOEXEC) = 6
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/perl-base/auto/List/Util/Util.so", O_RDONLY|O_CLOEXEC) = 6
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/perl-base/Carp.pm", O_RDONLY|O_CLOEXEC) = 5
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/perl/5.32/Time/HiRes.pm", O_RDONLY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/perl/5.32/auto/Time/HiRes/HiRes.so", O_RDONLY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache", O_RDONLY) = 4
openat(AT_FDCWD, "/etc/apt/apt.conf.d/", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 4
openat(AT_FDCWD, "/etc/apt/apt.conf.d/00CDMountPoint", O_RDONLY|O_NOCTTY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/etc/apt/apt.conf.d/00aptitude", O_RDONLY|O_NOCTTY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/etc/apt/apt.conf.d/00trustcdrom", O_RDONLY|O_NOCTTY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/etc/apt/apt.conf.d/01autoremove", O_RDONLY|O_NOCTTY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/etc/apt/apt.conf.d/01autoremove-kernels", O_RDONLY|O_NOCTTY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/etc/apt/apt.conf.d/01autoremove-postgresql", O_RDONLY|O_NOCTTY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/etc/apt/apt.conf.d/50apt-file.conf", O_RDONLY|O_NOCTTY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/etc/apt/apt.conf.d/50command-not-found", O_RDONLY|O_NOCTTY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/etc/apt/apt.conf.d/50kali", O_RDONLY|O_NOCTTY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/etc/apt/apt.conf.d/70debconf", O_RDONLY|O_NOCTTY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/etc/apt/apt.conf.d/80debtags", O_RDONLY|O_NOCTTY|O_CLOEXEC) = 4
Finding relevant cache files to search ...--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=36892, si_uid=504, si_status=0, si_utime=0, si_stime=1} ---
Searching through filenames ...--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=36895, si_uid=504, si_status=0, si_utime=0, si_stime=0} ---
lshw-gtk: /usr/bin/lshw-gtk    
+++ exited with 0 +++

答案1

解析apt-file来自*Contents*.lz4的文件/var/lib/apt/lists

有关详细信息,请参阅:

相关内容