Linux / UNIX find out size of email account or mailbox

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

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.