Linuxにインストールされているパッケージのリスト
1. 概要
Linuxベースのシステムは、クライアントアプリケーションを使用してパッケージ管理を支援します。 一部のソフトウェアパッケージはデフォルトでプレインストールされていますが、Linuxユーザーは必要に応じて他のパッケージをインストールできます。
このチュートリアルでは、Linuxにインストールされているすべてのパッケージを一覧表示する5つの方法を紹介します。 apt 、 dpkg 、 snap 、 dnf、およびflatpak。
2. aptパッケージマネージャーの使用
apt は、UbuntuなどのDebianベースのシステムでAdvanced Packaging Tool(APT)と連携するコマンドラインツールです。 これは、新しいソフトウェアパッケージのインストール、既存のソフトウェアパッケージのアップグレード、パッケージリストインデックスの更新、およびUbuntuシステム全体のアップグレードに使用されます。
2.1. インストールされているパッケージのリスト
– –installed タグを使用して、インストールされているパッケージのみを一覧表示します。
$ apt list --installed | head
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Listing...
accountsservice/now 0.6.55-0ubuntu12~20.04.4 amd64 [installed,upgradable to: 0.6.55-0ubuntu12~20.04.5]
acl/focal,now 2.2.53-6 amd64 [installed,automatic]
acpi-support/focal,now 0.143 amd64 [installed,automatic]
acpid/focal,now 1:2.0.32-1ubuntu1 amd64 [installed,automatic]
adduser/focal,focal,now 3.118ubuntu2 all [installed,automatic]
adwaita-icon-theme/focal-updates,focal-updates,now 3.36.1-2ubuntu0.20.04.2 all [installed,automatic]
aisleriot/focal,now 1:3.22.9-1 amd64 [installed,automatic]
alsa-base/focal,focal,now 1.0.25+dfsg-0ubuntu5 all [installed,automatic]
alsa-topology-conf/focal,focal,now 1.2.2-1 all [installed,automatic]
...
インストールされたパッケージには、これら3つのタグのいずれかがあります。 [インストール済み]、[インストール済み、自動]、[インストール済み、ローカル]
- [installed] –ソフトウェアパッケージがリポジトリリストから手動でインストールされたことを示します
- [installed、automatic] –ソフトウェアパッケージが別のソフトウェアパッケージの依存関係として自動的にインストールされたことを示します
- [installed、local] –ソフトウェアパッケージが公式リポジトリリストに含まれていないことを示します
2.2. パッケージのリスト
apt list コマンドを使用して、インストールされているすべての利用可能なパッケージを一覧表示します。
$ apt list | head
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Listing...
0ad-data-common/focal,focal 0.0.23.1-1 all
0ad-data/focal,focal 0.0.23.1-1 all
0ad/focal 0.0.23.1-4ubuntu3 amd64
0install-core/focal 2.15.1-1 amd64
0install/focal 2.15.1-1 amd64
0xffff/focal 0.8-1 amd64
2048-qt/focal 0.1.6-2build1 amd64
2ping/focal,focal 4.3-1 all
2to3/focal,focal 3.8.2-0ubuntu2 all
aptlistコマンドの出力は非常に長いです。 それをheadコマンドにパイプして、最初の10行だけをリストします。
2.3. 特定のパッケージを一覧表示
apt list コマンドにパッケージ名を追加して、特定のパッケージを一覧表示します。
$ apt list python3 --installed
Listing... Done
python3/focal,now 3.8.2-0ubuntu2 amd64 [installed,automatic]
パッケージpython3の詳細をリストします。
3. dpkgパッケージマネージャーの使用
dpkg は、Debianベースのシステム用のパッケージマネージャーです。
システムにインストールされているパッケージを一覧表示するには:
$ dpkg --get-selections | grep -w "install" | head
accountsservice install
acl install
acpi-support install
acpid install
adduser install
adwaita-icon-theme install
aisleriot install
alsa-base install
alsa-topology-conf install
alsa-ucm-conf install
– –get-selections は、パッケージ選択のリストを取得し、出力をstdoutに書き込みます。 この出力をgrepコマンドにパイプ処理できます。このコマンドは、「install」という単語に一致する行を選択します。 head コマンドは、出力の最初の1o行を表示することにより、出力をトリミングするのに役立ちます。
もう1つの方法は、dpkg-queryツールを使用することです。 このツールは、dpkgデータベースを照会します。
$ dpkg-query -l | head
ii accountsservice 0.6.55-0ubuntu12~20.04.4 amd64 query and manipulate user account information
ii acl 2.2.53-6 amd64 access control list - utilities
ii acpi-support 0.143 amd64 scripts for handling many ACPI events
ii acpid 1:2.0.32-1ubuntu1 amd64 Advanced Configuration and Power Interface event daemon
ii adduser 3.118ubuntu2 all add and remove users and groups
ii adwaita-icon-theme 3.36.1-2ubuntu0.20.04.2 all default icon theme of GNOME (small subset)
ii aisleriot 1:3.22.9-1 amd64 GNOME solitaire card game collection
ii alsa-base 1.0.25+dfsg-0ubuntu5 all ALSA driver configuration files
ii alsa-topology-conf 1.2.2-1 all ALSA topology configuration files
ii alsa-ucm-conf 1.2.2-1ubuntu0.5 all ALSA Use Case Manager configuration files
-l オプションは、システムにインストールされているすべてのパッケージを一覧表示します。
4. snapパッケージマネージャーの使用
snap は、Canonicalによって開発されたLinuxの代替パッケージマネージャーです。
snap list コマンドは、snapを使用してインストールされたすべてのパッケージを一覧表示します。
$ snap list
Name Version Rev Tracking Publisher Notes
core 16-2.54.4 12834 latest/stable canonical* core
hello-world 6.4 29 latest/stable canonical* -
5. dnfパッケージマネージャーの使用
dnf は、RedHatベースのシステムのyumパッケージマネージャーの代わりになることを目的としています。
dnf を使用して、システムにインストールされているパッケージを一覧表示するには、次の手順に従います。
$ dnf list installed
Installed Packages
acl.x86_64 2.2.53-1.el8 @anaconda
audit.x86_64 3.0-0.10.20180831git0047a6c.el8 @anaconda
audit-libs.x86_64 3.0-0.10.20180831git0047a6c.el8 @anaconda
6. flatpakを使用する
flatpak は、さまざまなLinuxディストリビューションにソフトウェアを配布するために使用されるパッケージ管理ソフトウェアです。
システムにインストールされているすべてのflatpakアプリケーションを表示するには:
$ flatpak list --app
Name Application ID Version Branch Installation
Fondo com.github.calo001.fondo 1.3.8 stable system
Flatseal com.github.tchx84.Flatseal 1.5.2 stable system
GNOME Boxes org.gnome.Boxes 3.36.6 stable system
7. 結論
このチュートリアルでは、 apt コマンドを使用して、Linuxにインストールされているすべてのパッケージと使用可能なパッケージを一覧表示する方法を説明しました。 また、 dpkg 、 dpkg-query 、 snap 、 dnf、、flatpakを使用して一覧表示する方法も学習しました。インストールされたパッケージ。