File manager - Edit - /usr/local/sbin/disk_usage
Back
#!/bin/bash YELLOW_COLOR=$'\033[33;1m' RED_COLOR=$'\033[31;1m' DEFAULT_COLOR=$'\033[0m' echo Free Space: df -h | grep 'Filesystem\|/dev/root\|/dev/sda' echo echo Largest Server Directories: du -sh /backup /home /var /usr /root | grep G | sort -rh echo files_larger_than_500_mb=$(find / -maxdepth 7 -type f -size +500M \( -name '*.zip' -o -name '*.7z' -o -name '*.gz' -o -name '*.bz2' -o -name '*.xz' -o -name '*.tar' -o -name '*rar' -o -name '*log' \) -exec du -hsxc {} + | sort -rh) if [ -n "$files_larger_than_500_mb" ]; then echo Files Larger Than 500MB: echo "$files_larger_than_500_mb" echo fi echo Would you like to an indepth review of the server disk usage to be performed? printf "%s--WARNING--This can take more than 1 hour, depending on the size of the server.--WARNING--%s\\n" "$RED_COLOR" "$DEFAULT_COLOR" read -e -r -p $'\e[36mPerform Indepth Review? (y/n):\e[0m ' indepth_review; while :; do if [[ "$indepth_review" != 'y' && "$indepth_review" != 'n' ]]; then printf "%sIncorrect Value!%s\\n" "$RED_COLOR" "$DEFAULT_COLOR" read -e -r -p $'\e[36mPerform Indepth Review? (y/n):\e[0m ' indepth_review; indepth_review="${indepth_review,,}" else break fi done if [ "$indepth_review" = 'y' ]; then printf "%sPerforming Indepth Review...%s\\n" "$YELLOW_COLOR" "$DEFAULT_COLOR" echo Largest Directories in the Home of the Server\(Calculating only the Files in the Current Directory\): find /home/ -maxdepth 10 -type d | while read -r dir; do size=$(find "$dir" -maxdepth 1 -type f -exec du -hsxc {} + | sort -rh | head -n 1 | awk '{print$1}'); echo "$size $dir" done | sort -rh | head -n 20 echo echo Size of the Largest Directories in the Home of the Server\(Tree Structure\): find /home/ -maxdepth 10 -type d | while read -r dir; do size=$(du -sh "$dir" | cut -d ' ' -f 1 ); echo "$size" done | sort -rh | head -n 20 fi
| ver. 1.4 |
Github
|
.
| PHP 8.2.30 | Generation time: 0 |
proxy
|
phpinfo
|
Settings