Ubuntu 的apt install 和卸载正确姿势

先说下使用apt  installl 安装的包的卸载:

apt-get remove: 卸载软件
apt-get purge: 卸载软件和配置文件
apt-get autoremove: 移除没有使用的依赖
apt-get clean: 删除/var/cache/apt/archives/下的所有deb包
apt-get autoclean: 删除/var/cache/apt/archives/下的过期deb包

==============gold  line ==============

根据以上,我们可以知道完全卸载一个软件可以按照这个流程1

官方演示:https://linuxprograms.wordpress.com/2010/05/12/remove-packages-marked-rc/

apt-get purge [package]
apt-get autoremove [package]

dpkg --list | grep "^ii" | cut -d " " -f 3 | xargs sudo dpkg --purge

也可以这样写,等价的:

dpkg -l |grep  "^ii"|awk '{print $2}' |grep -E  'influx|grafana' |xargs  dpkg --pure 

 

 

如何同时匹配多个呢:

dpkg -l |grep "^ii"|cut -d " " -f 3 |grep -E 'influx|grafana'
grafana
influxdb

这样就可以同时过滤除包含influx和grafana 所有的符合条件了,记得加-E.

 

第二列就是我们要的包的名称

 

 单独抓取第二列:

 

posted @ 2020-02-10 18:18  不带R的墨菲特  阅读(17351)  评论(0编辑  收藏  举报