Added Liebranca.
This commit is contained in:
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "🔍 Analyzing disk usage... Please wait."
|
||||
|
||||
# 1. Show overall disk usage
|
||||
echo -e "\n📊 Disk Usage Overview:"
|
||||
df -h
|
||||
|
||||
# 2. Show the largest directories in /
|
||||
echo -e "\n📂 Top 10 Largest Directories in Root (/):"
|
||||
du -ahx / 2>/dev/null | sort -rh | head -10
|
||||
|
||||
# 3. Show the largest directories in /home
|
||||
echo -e "\n🏠 Top 10 Largest Directories in /home:"
|
||||
du -ahx /home 2>/dev/null | sort -rh | head -10
|
||||
|
||||
# 4. Show the largest files over 1GB
|
||||
echo -e "\n📄 Top 10 Largest Files Over 1GB:"
|
||||
find / -type f -size +1G -exec ls -lh {} + 2>/dev/null | sort -k5 -rh | head -10
|
||||
|
||||
# 5. Check system logs
|
||||
echo -e "\n📝 Checking Large Log Files in /var/log:"
|
||||
sudo du -sh /var/log/* 2>/dev/null | sort -rh | head -10
|
||||
|
||||
# 6. Find large installed packages (Debian-based)
|
||||
if command -v dpkg-query &> /dev/null; then
|
||||
echo -e "\n📦 Top 10 Largest Installed Packages (Debian-based):"
|
||||
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -rh | head -10
|
||||
fi
|
||||
|
||||
# 7. Find large installed packages (RPM-based)
|
||||
if command -v dnf &> /dev/null; then
|
||||
echo -e "\n📦 Top 10 Largest Installed Packages (Fedora-based):"
|
||||
dnf list installed | awk '{print $2, $1}' | sort -rh | head -10
|
||||
fi
|
||||
|
||||
echo -e "\n✅ Disk Usage Analysis Completed!"
|
||||
Reference in New Issue
Block a user