Thursday, July 24, 2008

How To Sort and List The Largest Mailbox User

Being aware of the server's remaining partition's capacity with respect to total account's mailbox usage, particularly with /var partition, is one good practice that brings anybody one step ahead of server disk capacity monitoring and planning. This storage capacity monitoring can be done via web inteface, email alerts or direct from command line terminal.

There are times, you just need to have a quick view of account users occupying the largest portion of your mail partition, just for a quick check. There could be a time when you need to list down the top listing of most mailbox receivers or the currently highest mbox file size from your current terminal.

Here's how to check the top most disk space consuming account user from your linux box

To determine the top list of mailbox user

Go to your mbox partition folder

# cd /var/mail

List down a set of system users with the highest mbox size. This could be using linux ls command with sorting parameter

# ls -lS

The above list down all mbox system users sorted from highest to lowest mbox size.

Now, to list down the top 10 of most active mbox user,  simply

# ls -lS | head -10

-rw-rw---- 1 mfeyisola        mail        1899991503 Jul 24 11:35 mfeyisola
-rw-rw---- 1 kekechukwu       mail        1783244690 Jul 24 11:34 kekechukwu
-rw------- 1 arakoyounian     mail        1620349072 Jul 24 11:41 arakoyounian
-rw------- 1 kadaramoye       users       1144226769 Jul 24 11:29 kadaramoye
-rw-rw---- 1 conukegbe        mail        1092718167 Jul 24 11:32 conukegbe
-rw------- 1 tmoussalli       mail        1087506538 Jul 24 11:41 tmoussalli
-rw------- 1 aogiri           mail         878866381 Jul 24 11:42 aogiri
-rw------- 1 mobateru         mail         874813665 Jul 24 11:42 mobateru
-rw-rw---- 1 jesedebe         mail         820077436 Jul 24 11:33 jesedebe
With reverse effect, to list down the least active mailbox system users,


# ls -lS | tail -10

-rw-rw---- 1 rpm       mail     0 2008-07-18 18:15 rpm
-rw-rw---- 1 smmsp     mail     0 2008-07-18 18:16 smmsp
-rw-rw---- 1 squid     mail     0 2008-07-18 18:17 squid
-rw-rw---- 1 sshd      mail     0 2008-07-18 18:19 sshd
-rw-rw---- 1 tcpdump   mail     0 2008-07-18 18:17 tcpdump
-rw-rw---- 1 torrent   mail     0 2008-07-18 18:18 torrent
-rw-rw---- 1 vcsa      mail     0 2008-07-18 18:16 vcsa
-rw-rw---- 1 ver       mail     0 2008-07-18 20:33 ver
-rw-rw---- 1 webalizer mail     0 2008-07-18 18:17 webalizer
-rw-rw---- 1 xfs       mail     0 2008-07-18 18:20 xfs

These commands could be expanded and be integrated with other linux command like awk and grep.

All is done

0 comments:

Sign up for PayPal and start accepting credit card payments instantly.
ILoveTux - howtos and news | About | Contact | TOS | Policy