例如,当我想删除 Xfce 时,我这样做:
aptitude search xfce | grep ^i
id gtk2-engines-xfce - GTK+-2.0 theme engine for Xfce
id libxfce4ui-common - common files for libxfce4ui
id libxfce4util-common - common files for libxfce4util
我想获取第二列并将它们传递给aptitude remove
。 有办法吗?
答案1
apt-get
支持正则表达式。只需在包名称中包含.
,*
或?
即可使其成为表达式:
apt-get remove 'xfce.'
If no package matches the given expression and the expression
contains one of '.', '?' or '*' then it is assumed to be a POSIX
regular expression, and it is applied to all package names in the
database. Any matches are then installed (or removed). Note that
matching is done by substring so 'lo.*' matches 'how-lo' and
'lowest'. If this is undesired, anchor the regular expression with
a '^' or '$' character, or create a more specific regular
expression.