mailq Command in Linux with Examples

The name itself suggests, mailq i.e. “mail-queue”, this command in Linux prints the mail queue i.e the list of messages that are there in the mail queue. You should have a mail-server setup on your Linux machine, in order to use this command, there are ways i.e MTA’s(Mail Transfer agent) you can use like sendmail that uses the service smtp.

The output of mailq command is similar to the sendmail -bp command that also prints the mail queue.

Syntax:

mailq [options]

Examples:

1. maliq without any option: Simply prints the messages in the mail queue.



$ mailq

Output

 Mail Queue (1 request)
---QID---- --Size-- -----Q-Time----- ------Sender/Recipient-----
SS04506        5    Tue Nov 12 09:01            root
            (User unknown)

2. Prints along with priority specified: Simply prints the messages in the mail queue.

$ mailq -v

Output

 Mail Queue (1 request)
---QID---- --Size-- -Priority- -----Q-Time----- ------Sender/Recipient-----
SS04506        5      2005     Tue Nov 12 09:01            root
            (User unknown)

Here,

  • QID: Specific ID alloted to message.
  • Size: Number of bytes contained in body of message.
  • Q-Time Time at which message entered the queue.

Applications: In large applications at production env, email queuing is necessary as recipients are quite good in number, so sending the email to all at the same time becomes a risky thing, so mailq helps in looking out the sequence as per the priority.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.