Linux / UNIX find out size of email account or mailbox

by Vivek Gite on June 7, 2007 · 2 comments

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

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

{ 2 comments… read them below or add one }

1 Ameya June 8, 2007

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

Reply

2 Cosmix June 21, 2007

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

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

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 7 + 2 ?
Please leave these two fields as-is:
Solve the simple math so we know that you are a human and not a bot.



Previous post:

Next post: