在Debian系统中清理垃圾文件可通过以下方式操作:
sudo apt-get cleansudo apt-get autocleansudo apt-get remove <软件名>sudo apt-get purge <软件名> 或 sudo aptitude purge <软件名>sudo apt-get autoremovesudo truncate -s 0 /var/log/<日志文件名>sudo find /var/log -type f -mtime +30 -exec rm -f {} \;/etc/logrotate.conf。sudo journalctl --vacuum-time=2weeks删除两周前日志。sudo rm -rf /tmp/*ncdu工具扫描大文件:
sudo apt-get install ncdusudo ncdu /,手动删除不需要的大文件。注意:执行删除操作前建议备份重要数据,谨慎使用rm -rf命令。可定期将清理命令添加到cron作业中实现自动化。