Q. I would like to show the list of email accounts which used the most disk on my Linux mail server. How do I find out size of email account?
A. Usually mail is stored in /var/mail directory. By running the following command you can get list of email account disk size.
ls -lL will display user filesize.
Use awk command to print user mailbox size along with username
Finally sort command will sort mailbox size.
Type the command:
$ ls -lL /var/mail | awk '{print $5, $9}' | sort -rn
OR
$ ls -lL /var/mail | awk '{print $5, $9}' | head -10
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop












{ 2 comments… read them below or add one }
Dear Vivek,
I am recent.. but a regular visitor to your site. It is very informative and thank you for that.
The command you have mentioned here do not actually gives output of the Directory Size. It shows below ouput.
root@ameya:~# ls -lL /var/mail | awk ‘{print $5, $9}’ | head -3
4096
4096
4096
I think for the exact results below command will be more useful.
root@ameya:~# du -h /var/mail | awk ‘{print $1, $2}’ |more
Please lemme know about your views and suggesstions.
:Ameya
Take this route for a “Top 10 largest mail INboxes” :
#cd /var/spool/mail
#ls -lS | head -10