Find user Bandwidth via SSH shell (CPanel/WHM)
1)Create a new file with following code.
2) chmod +x bandwidth
3) Then execute the file with 2 parameters viz. month and year.
vi bandwidth
#!/bin/bash
cd /var/cpanel/bandwidth/
ls | grep -v “\.” | xargs -n 1 -izzz sh -c “echo -n zzz \” = \”; egrep \”^$1\..*\.$2-all\” zzz | awk -F’=’ ‘START {bytes=0} { bytes+=\$2 } END {print bytes/1024/1024 \” MB\”}'”
cd –
Usage:
./bandwidth month year
Eg To see top 10 BW taking users in January 2012
./bandwidth 1 2012 | sort -nrk 3 | head -10
The above will show the result in the descending order. It will display the  highest BandWidth usage account first.
User names can be related with domain names from /etc/trueuserdomainsÂ
If you execute the script, the output will be this.
./bandwidth 1 2012 | sort -nrk 3 | head -10
xxxx = 68201.2 MB
xxxx = 42244.8 MB
xxxx = 27904.6 MB
xxxx = 23245.1 MB
xxxx = 20558.4 MB
xxxx = 16451.2 MB
xxxx = 11469.4 MB
xxxx = 9804.84 MB
xxxx = 8368.28 MB
xxxx = 7933.61 MB