In the classic Unix 'mail' command interface, which single-letter command saves the current message into a separate file (mailbox or named file)?
-
As
-
Br
-
Cw
-
Dd
-
ENone of the above
Answer
Correct Answer: s
Explanation
Introduction / Context:Traditional Unix mail programs provide single-letter commands to manage messages from within the interactive prompt. Knowing how to save a message to a separate mailbox or file is essential for archiving, forwarding through scripts, and organizing important correspondence from the terminal.
Given Data / Assumptions:
- Using the classic mail (or mailx) command-line interface.
- You have a message selected (by default the current one).
- You want to save it to a specified filename or mailbox.
Concept / Approach:
The s command (save) writes the current message to a named file or mailbox, including headers. Syntax typically is s filename. The similar command w (write) often writes the message body only (omitting some headers) depending on implementation, while d deletes, and r replies.
Step-by-Step Solution:
Open mail interface: mailSelect/read a message: type its number or press Enter for current.Save it: s saved.txt (or s +folder for mailbox)Quit: q (messages marked for deletion are removed)Verification / Alternative check:
After saving, check the target file with ls -l saved.txt and view its contents using less saved.txt. You should see the message with headers intact.
Why Other Options Are Wrong:
- r: reply to sender; does not save.
- w: writes the message (often body only); the question emphasizes saving to a separate file in standard practice, which is s.
- d: delete message.
- None of the above: incorrect because s is the conventional save command.
Common Pitfalls:
- Confusing s and w differences across variants (mail vs mailx vs Heirloom); when in doubt, check man mail.
- Forgetting to specify a filename causes save to default mailbox behavior.
Final Answer:
s.