On multi-user Unix/Linux systems, which command broadcasts a message to all users currently logged in (for example, for maintenance notices)?
-
Awall
-
Bwrite
-
Cmail
-
Dmesg
-
ENone of the above
Answer
Correct Answer: wall
Explanation
Introduction / Context:System administrators often need to alert every active user about impending maintenance, shutdowns, or policy changes. Unix-like systems provide terminal-messaging utilities that can target one user, a group, or everyone with an interactive session.
Given Data / Assumptions:
- Multiple users are logged in to terminals or pseudo-terminals.
- You need immediate, real-time notification.
- Permissions allow writing to user terminals.
Concept / Approach:The wall (write all) command sends a message to all logged-in users by writing to their terminals. By contrast, write targets a single user (for example, write alice), mail delivers e-mail and is not instantaneous, and mesg controls whether a user's terminal can receive messages (mesg y/n). For urgent broadcast communication, wall is the canonical choice.
Step-by-Step Solution:
Compose a message and broadcast: echo "System maintenance in 5 minutes" | sudo wallVerify delivery: check multiple terminals for the broadcast banner.If some users do not receive it, confirm mesg settings and terminal availability.Follow up via mail if a persistent record is needed.Verification / Alternative check:Run who or w to list logged-in users and their TTYs. After sending with wall, observe that all TTYs display the same message, confirming system-wide broadcast.
Why Other Options Are Wrong:
- write: One-to-one messaging; not a broadcast.
- mail: Asynchronous e-mail; not immediate terminal broadcast.
- mesg: Toggles permission to receive writes; not a messaging command itself.
- None of the above: Incorrect because wall accomplishes the broadcast.
Common Pitfalls:Assuming wall overrides a user's mesg n setting or forgetting sudo/root may be required to reach all terminals on some systems.
Final Answer:wall