使用 dpkg 卸載軟體包

使用 dpkg 卸載軟體包

我想卸載 openoffice 軟體包並想使用單一命令或正規表示式 ie 來執行此操作

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* 字典-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*

使用以上是安全的方法。

相關內容