Linux / UNIX find out size of email account or mailbox

Posted on in Categories , , , , , , , last updated June 7, 2007

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
$ ls -lL /var/mail | awk '{print $5, $9}' | head -10

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

2 comment

  1. 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.

    [email protected]:~# ls -lL /var/mail | awk ‘{print $5, $9}’ | head -3


    I think for the exact results below command will be more useful.

    [email protected]:~# du -h /var/mail | awk ‘{print $1, $2}’ |more

    Please lemme know about your views and suggesstions.


Leave a Comment