Как удалить некоторые пакеты, содержащие определенное ключевое слово?

Например, когда я хочу удалить 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.'

От man apt-get:

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.
Другие вопросы по тегам