Skip to content

Instantly share code, notes, and snippets.

@alonsoir
Last active March 6, 2025 08:33
Show Gist options
  • Save alonsoir/a5b79bb69db5064e034c6e4fce52950e to your computer and use it in GitHub Desktop.
Save alonsoir/a5b79bb69db5064e034c6e4fce52950e to your computer and use it in GitHub Desktop.
zsh osx utility...
#!/bin/zsh
# Título del script
echo "\n============================================="
echo " ANALIZADOR DE ESPACIO EN DISCO PARA MACOS"
echo "=============================================\n"
# Información general del sistema
echo "INFORMACIÓN DEL SISTEMA:"
echo "---------------------------------------------"
system_profiler SPSoftwareDataType | grep "System Version" | sed 's/^ *//'
df -h / | grep -v Filesystem | awk '{print "Espacio total: " $2 "\nEspacio usado: " $3 "\nEspacio disponible: " $4 "\nPorcentaje usado: " $5}'
echo "---------------------------------------------\n"
# Tamaño de carpetas principales del usuario
echo "ANÁLISIS DE CARPETAS PRINCIPALES DEL USUARIO:"
echo "---------------------------------------------"
for dir in ~/Desktop ~/Documents ~/Downloads ~/Library ~/Movies ~/Music ~/Pictures; do
if [ -d "$dir" ]; then
du -sh "$dir" 2>/dev/null | awk '{printf "%-12s %s\n", $1, $2}'
fi
done
echo "---------------------------------------------\n"
# Archivos más grandes en el directorio del usuario (>100MB)
echo "ARCHIVOS MÁS GRANDES (>100MB) EN CARPETA PERSONAL:"
echo "---------------------------------------------"
find ~/ -type f -size +100M -exec du -sh {} \; 2>/dev/null | sort -hr | head -10
echo "---------------------------------------------\n"
# Análisis de aplicaciones
echo "APLICACIONES MÁS GRANDES:"
echo "---------------------------------------------"
du -sh /Applications/* 2>/dev/null | sort -hr | head -15
echo "---------------------------------------------\n"
# Análisis de caché y bibliotecas
echo "CACHÉ Y BIBLIOTECAS DEL USUARIO:"
echo "---------------------------------------------"
du -sh ~/Library/Caches 2>/dev/null | awk '{print "Caché: " $1 " " $2}'
du -sh ~/Library/Application\ Support 2>/dev/null | awk '{print "Application Support: " $1 " " $2}'
du -sh ~/Library/Containers 2>/dev/null | awk '{print "Contenedores: " $1 " " $2}'
echo "---------------------------------------------\n"
# Otros directorios típicamente grandes
echo "OTRAS UBICACIONES A VERIFICAR:"
echo "---------------------------------------------"
du -sh /private/var/vm 2>/dev/null | awk '{print "Memoria Virtual: " $1 " " $2}'
du -sh /Library/Caches 2>/dev/null | awk '{print "Caché del Sistema: " $1 " " $2}'
du -sh /System/Library 2>/dev/null | awk '{print "Bibliotecas del Sistema: " $1 " " $2}'
echo "---------------------------------------------\n"
echo "ANÁLISIS COMPLETADO. Revisa las secciones anteriores para ubicar archivos grandes."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment