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

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 2 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
2 comments… add one
  • Ameya Jun 8, 2007 @ 9:27

    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


    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.


  • Cosmix Jun 21, 2007 @ 18:30

    Take this route for a “Top 10 largest mail INboxes” :

    #cd /var/spool/mail
    #ls -lS | head -10

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum