About Linux FAQ

Browse More FAQs:

Advertisements

Linux / UNIX find out size of email account or mailbox

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

Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

Related Other Helpful FAQs:

Discussion on This FAQ

  1. Ameya Says:

    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

  2. Cosmix Says:

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

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

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.