美文网首页
debian下的软件包清理shell脚本

debian下的软件包清理shell脚本

作者: MangfuStudio | 来源:发表于2019-06-06 17:29 被阅读0次

一个用于清除无用软件包的shell脚本

time_now=`date "+%H:%M:%S"`
echo "==================== Start $time_now ===================="

sudo apt-get autoclean
sudo apt-get autoremove

# 清除系统中
#   用户安装但配置失败(iF)
#   用户安装安装但只解压(iU)并未成功安装
#   用户删除但由残留配置文件(rc)
# 的软件包以及软件包的配置文件
package_name=`dpkg -l | grep -e ^iF -e ^iU -e ^rc | awk '{print $2}'`
if [ -n "$package_name" ];then
    echo $package_name | sudo xargs -n 1 dpkg -P 
fi

time_now=`date "+%H:%M:%S"`
echo "==================== End $time_now ===================="

相关文章

网友评论

      本文标题:debian下的软件包清理shell脚本

      本文链接:https://www.haomeiwen.com/subject/lsvuxctx.html