102-500 practice question 20 of 30

What command should be used to print a listing of email in the system's mail queue?

Full set: 233 questions
Answer options
A: lpq
B: mailq Correct answer
C: mlq
D: sendmail –l
Correct Answer:
B. mailq
Explanation

The mailq command is the standard, user-friendly utility for displaying a list of all messages currently held in the mail queue. It provides a summary of queued messages, including the queue ID, size, arrival time, sender, and recipients. This command is a part of common Mail Transfer Agents (MTAs) like Sendmail and Postfix and is often implemented as a symbolic link or an alias to a more complex command, such as sendmail -bp, to provide a simple interface for a common administrative task.

Why Incorrect

A. lpq: This command is used to view the status of the line printer (print) queue, not the email queue.
C. mlq: This is not a standard command for viewing the mail queue on Linux systems.
D. sendmail –l: The -l option is not a valid flag for the sendmail command to list the mail queue. The correct flag is -bp.

References

- mailq(1) Linux man page. The description explicitly states: "mailq prints a summary of the mail messages queued for future delivery."

- sendmail(8) Linux man page. The description for the -bp option states it will "Print a listing of the mail queue," and notes that mailq is an equivalent invocation.

- Postfix documentation, postqueue(1) man page. It describes the mailq command as a Postfix utility that is compatible with the Sendmail mailq command for listing the queue.

Scroll to Top