あるコマンドやファイルなどがすでに手元の環境にはインストールされているけれども、別の環境で同じものを
インストールしたい場合、はて、どのパッケージをインストールすればいいんだったっけ?と困ることがまあまああるので。
Ubuntu Linuxの話です。
こういう場合、apt-fileを使うそうです。
インストール。
$ sudo apt install apt-file
apt-fileを使う時には、パッケージ情報を更新しておく必要があります。
$ sudo apt-file update
あとは、ファイルを含むパッケージを「apt-file search」で検索します。
たとえば、「/bin/ss」を検索してみましょう。
$ apt-file search /bin/ss
…部分一致なので、ものすごく大量にヒットします。
完全一致にする場合は、「-F」オプションを使います。
$ apt-file search -F /bin/ss iproute2: /bin/ss
パターンのオプション。
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 --substring-match pattern is a substring (no glob/regex) --regexp -x pattern is a regular expression
ヘルプは、「apt-file help」で。
$ apt-file help
覚えておきましょう。