Last active
July 3, 2023 21:35
-
-
Save viniciusgonmelo/db5839661e8af9c392b54bd2d0181a84 to your computer and use it in GitHub Desktop.
Comandos para liberar espaço na partição root do Debian.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Libera espaço da partição root no Debian | |
# Executar os comandos como root | |
if [ "$EUID" -ne 0 ] | |
then echo "Executar como root" | |
exit | |
fi | |
# Limpa o repositório local | |
apt autoclean | |
# Remove pacotes orfãos e os arquivos de configuração | |
apt autoremove --purge | |
# Limpa arquivos temporários | |
find /tmp -type f -delete | |
# Remove logs antigos | |
journalctl --rotate | |
journalctl --vacuum-time=7d | |
# Remove kernels antigos | |
dpkg --list \ | |
| grep linux-image \ | |
| awk '{ print $2 }' \ | |
| sort -V \ | |
| sed -n '/'"$(uname -r)"'/q;p' \ | |
| xargs sudo apt-get -y purge |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment