Ubuntu 22.04 パッケージ検索ツールapt-fileをインストールする

環境
OSバージョンを確認します

# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.1 LTS"

操作方法
1.apt-fileをインストールします

# sudo apt install -y apt-file

2.ヘルプを確認します

# apt-file -h

apt-file [options] action [pattern]
apt-file [options] -f action <file>
apt-file [options] -D action <debfile>

Pattern options:
================

    --fixed-string     -F               Do not expand pattern
    --from-deb         -D               Use file list of .deb package(s) as
                                        patterns; implies -F
    --from-file        -f               Read patterns from file(s), one per line
                                        (use '-' for stdin)
    --ignore-case      -i               Ignore case distinctions
    --regexp           -x               pattern is a regular expression
    --substring-match                   pattern is a substring (no glob/regex)


Search filter options:
======================

    --architecture     -a  <arch>       Use specific architecture [L]
    --index-names      -I  <names>      Only search indices listed in <names> [L]
    --filter-suites        <suites>     Only search indices for the listed <suites> [L]
                                        (E.g. "unstable")
    --filter-origins       <origins>    Only search indices from <origins> [L]
                                        (E.g. "Debian")

Other options:
==============

    --config           -c <file>        Parse the given APT config file [R]
    --option           -o <A::B>=<V>    Set the APT config option A::B to "V" [R]
    --package-only     -l               Only display packages name
    --verbose          -v               run in verbose mode [R]
    --help             -h               Show this help.
                       --               End of options (necessary if pattern
                                        starts with a '-')

[L]: Takes a comma-separated list of values.
[R]: The option can be used repeatedly

Action:
    list|show          <pattern>        List files in packages
    list-indices                        List indices configured in APT.
    search|find        <pattern>        Search files in packages
    update                              Fetch Contents files from apt-sources.

3.更新を行います

# apt-file update

4.apt-fileの使い方
書式
apt-file search キーワード
操作例
# apt-file search zlib.h

Ubuntu 22.04

Posted by arkgame