Disk Space

Checking Free Space


==============================
Check Space
==============================

df -h (Will check entire drives from any location)

du -hs * | sort -h (run in each folder as needed)

==============================
Wheres my diskspace?
==============================

# du --block-size=MiB --max-depth=1 | sort -n
# du -h <dir> | grep '[0-9\.]\+G'

==============================
Inodes - Top 30 Populated Directories:
==============================
# find / -xdev -printf '%h\n' | sort | uniq -c | sort -k 1 -n | tail -30

==============================
[Linux] Inodes Top Subdirectories in current directory:
==============================

# for i in `find . -type d `; do echo `ls -a $i | wc -l` $i; done | sort -n
# find . -type f -printf "%h\n" | cut -d/ -f-2 | sort | uniq -c | sort -n

==============================
Search from root for largest directories:
==============================

# du -k / | sort -n

==============================
Search for largest file in current dir:
==============================

# du -ms .

==============================
Disk Usage (Sorted by size):
==============================

# du --block-size=MiB --max-depth=1 | sort -n

==============================
Show All Files Over x Size:
==============================

# find /var/www/vhosts -type f -size +100000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'

==============================
List Files (Without Size):
==============================

# du / | cut -f2

==============================
To View total drive space / Partition Drives:
==============================

# fdisk -l