我想卸载 libreoffice。该程序由大约三打模块组成。理想情况下,它们可以通过以下方式删除:
aptitude remove libreoffice3.6* libreoffice-debian-menus libobasis3.6-*
Run Code Online (Sandbox Code Playgroud)
但这失败了
Couldn't find any package whose name or description matched "libreoffice3.6*"
Run Code Online (Sandbox Code Playgroud)
等等。
如何按模式删除一组包?
PS:我很高兴与使用的答案dpkg还是apt,太
Fli*_*imm 36
使用apt-get、不使用aptitude和使用正则表达式。
在正则表达式中,.表示任何字符,*表示零次或多次。因此该表达式libreoffice.*匹配任何包含字符串的包名称libreoffice,后跟任意数量的字符。
用单引号将正则表达式括起来,以避免 shell 解释星号。(如果您libreoffice.example在当前目录中有一个名为example的文件,shell 将替换libreoffice.*为libreoffice.example,因此您必须使用单引号来阻止这种行为。)
结果:
sudo apt-get remove 'libreoffice.*'
Run Code Online (Sandbox Code Playgroud)
aal*_*aap 10
另一种选择是:
dpkg -l | grep libreoffice | awk '{print $2}' | xargs -n1 echo
Run Code Online (Sandbox Code Playgroud)
这将列出所有匹配的包libreoffice。当你确认,他们都是你想摆脱的,运行以下命令谨慎:
dpkg -l | grep libreoffice | awk '{print $2}' | xargs -n1 sudo apt-get purge -y
Run Code Online (Sandbox Code Playgroud)
想法:
libreofficeAptitude 支持全局模式,还有另一个非常酷的匹配项,如下所示:
aptitude remove '?and(?name(libreoffice), name(3.6), ~i)' libreoffice-debian-menus
Run Code Online (Sandbox Code Playgroud)
这将匹配在它的名称的任何包装libreoffice和3.6也它的安装(这是什么~i代表。
| 归档时间: |
|
| 查看次数: |
33548 次 |
| 最近记录: |