Categories
Bash Scripts Uncategorized

List of Huge files – Check Disk usage – Linux

Create a file check_disk.sh

Paste below code the execute as ” bash check_disk.sh  ”

#!/bin/bash
for i in G M
do
du -ah / 2> /dev/null | grep [0-9]$i | sort -nr -k 1 | awk '$1 ~ "(M|G)$" {print $0}'
done

It may take some time depending on your number of files on server.