dpkg を使用してパッケージをアンインストールする

dpkg を使用してパッケージをアンインストールする

私はOpenOfficeパッケージをアンインストールしたいのですが、これを単一のコマンドまたは正規表現を使用して実行したいのです。

dpkg -r openoffice-org*

しかし、dpkgはワイルドカードを受け入れません

ワイルドカードを使用してすべてのパッケージをアンインストールするにはどうすればいいですか

答え1

ワイルドカードを使用して複数のパッケージを削除するワンライナーdpkg:

dpkg --list|grep openoffice|awk '{ print $2 }'|xargs sudo dpkg -r

答え2

実際、dpkgはワイルドカードをサポートしていません。そのため、その機能が必要な場合はこれが必要です。

dpkg --get-selections | grep "open-office" >list.txt

このファイルにはパッケージとステータスが含まれており、解析してdpkgに渡す必要があります。

答え3

使用できます

sudo apt-get purge openoffice.org-base-core openoffice.org-common openoffice.org-core openoffice.org-style-human uno-libs3 ure openoffice.org-thesaurus-en-au openoffice.org-thesaurus-en-us openoffice.org-hyphenation openoffice.org-hyphenation-en-us openoffice.org-l10n-common

パッケージを消去します。

ワイルドカードを実行すると、以下も削除されます。

aspell* aspell-en* dictionaries-common* hunspell-en-ca* hunspell-en-us* language-support-en* language-support-writing-en* myspell-en-au* myspell-en-gb* myspell-en-za* openoffice.org-base-core* openoffice.org-calc* openoffice.org-common* openoffice.org-core* openoffice.org-draw* openoffice.org-emailmerge* openoffice.org-gnome* openoffice.org-gtk* openoffice.org-help-en-us* openoffice.org-impress* openoffice.org-math* openoffice.org-style-human* openoffice.org-writer* python-uno* wbritish*

上記を使用するのが安全な方法です。

関連情報