Linux Classes
Linux Classes
Share This With a Friend
LINUX CLASSES - EMAIL

What Other Mail Commands Can I Use?

Exiting the Mail Program

The q command entered at the next mail prompt ends the session and returns you to the shell prompt. But take note of the messages that were printed on your way out: namely, Saved 1 message in /home/hermie/mbox and Held 2 messages in /var/mail/spool/hermie. For some odd reason, mail does not think it's a good idea to keep the mail you've already read in the /var/spool/mail/hermie file, so it moves read mail to a separate file called mbox in your own home directory. To access the messages in the mbox file, you have to use the command

mail -f mbox

Kind of annoying, ain't it? But at least the mail program looks and acts the same regardless of which mail file you're working with.

Other Mail Commands

Let's get back into the mail program and have some fun with the two messages that we didn't read before with this scenario (again, bold type represents your input):

$ mail

Mail version 5.6 6/1/95. Type ? for help.
"/var/spool/mail/hermie": 1 message 1 new
>U 1 D.Rhodes@spam.net Mon Feb 10 15:37 "Make Money Fast!"
U 2 Chris@qwerty.com Mon Feb 10 15:37 "Tennis, Anyone?"
& 2
Message 2:
Date: 1997年2月10日 15:37:52 -0500
From: Chris@qwerty.com
To: hermie@fritz.com
Subject: Tennis, Anyone?
Wanna whack a few a 4:30 today? -Chris
& reply
Subject: Re: Tennis, Anyone?
Sure, I'll see you on the lower courts at 4:30.
^D
EOT
& header
U 1 D.Rhodes@spam.net Mon Feb 10 15:37 "Make Money Fast!"
>O 2 Chris@qwerty.com Mon Feb 10 15:37 "Tennis, Anyone?"
& delete 1
& q
Saved 1 message in /home/hermie/mbox

We've introduced several new commands here, so let's take a closer look at the five operations that were performed in this mail session:

As soon as I started the mail program, the mail headers were displayed, showing that both messages are marked U for unread. I displayed message 2 by entering a 2 at the prompt.

The reply command responded with an appropriate Subject line for message 2, Subject: Re: Tennis, Anyone?, and waited for me to enter the text of my message to Chris. Pressing ctrl-D makes EOT appear and sends my reply.

The header command displays the message headers. I've used it here to show the difference in the status flags. The > indicates that message 2 is current, and the message is marked as O for old.

I deleted the first message with delete 1 without even reading it, since the Subject line was rather dubious.

And as a parting gesture, the q command told me that another message was squirreled away in that mbox file. At this point, if I issued the mail command again, the system would respond:

No mail for hermie

Poor hermie. He needn't drink Draino, though--he can always send himself some more mail. ;-)

Previous Lesson: Reading Email
Next Lesson: Using Pine for Email

[ RETURN TO INDEX ]



Comments - most recent first
(Please feel free to answer questions posted by others!)

wu633520 (07 Feb 2012, 20:59)
Hello!
I have a question, I hope to receive your help!
I wish to use the shell read the email and delete sendmail, not through mail terminal operation, what method?
Ken (06 Jan 2011, 13:20)
Love it, nothing beats old school mail!
ventura10 (14 Nov 2010, 17:35)
Thank you!

I welcome your comments. However... I am puzzled by many people who say "Please send me the Linux tutorial." This website *is* your Linux Tutorial! Read everything here, learn all you can, ask questions if you like. But don't ask me to send what you already have. :-)

NO SPAM! If you post garbage, it will be deleted, and you will be banned.
*Name:
Email:
Notify me about new comments on this page
Hide my email
*Text:




Copyright © by - Privacy Policy
All rights reserved - Redistribution is allowed only with permission.

Popular Linux Topics

Linux Intro
Linux Files
Linux Commands
Change Password
Copy Files
Linux Shell Basics

Linux Tutorial

Who is Doctor Bob?
What is Linux?
History of Unix
Operating Systems
What's Next?

Linux Basics

Living in a Shell
Root and Other Users
Virtual Consoles
Logoff and Shutdown
Choosing a Shell
The Command Prompt
Wildcards
Command History
Aliases
Redirection
Pipelines
Processes
Stopping a Program
Environment Variables
Help!

Linux Files

The Linux File System
Linux File Names
Linux Directories
Directory Terminology
Navigating the File System
Listing Linux Files
Displaying Linux Files
Copying and Renaming Files
Creating Files and Directories
Deleting Files and Directories
Linux Files - Wildcards
The Nine Deadly Keystrokes
Linux File Permissions
Changing File Permissions

Linux Commands

Important Linux Commands
Changing Your Password
Switching Users
Who is Logged In?
Date and Time
The Echo Command
Spell Checking
Printing Linux Files
Joining Files
Searching for Files
Comparing Files
Task Scheduling
Linking Files

Linux Editors

The Vi Editor
The Emacs Editor
The Pico Editor

Linux Data Manipulation

Slicing & Dicing
Heads or Tails?
Sorting Data
Eliminating Duplicates
Selecting Columns
Selecting Records
Search & Replace
Crunching Data
Finding Files
Pipe Fitting

Linux Shell Programming

Linux Shell Scripts
Executing a Script
Shell Script Variables
Shell Script Logic
Shell Script Looping
Shell Script Debugging

Perl Programming

Perl Basics
Perl Variables
Perl Arguments
Perl Logic
Perl Looping
Perl and Files
Perl Pattern Matching

Linux and Email

Sending Email
Reading Email
Other Mail Commands
Using Pine for Email
The Pine Inbox
Pine Email Basics
Pine Email Folders
Pine for Power Users

Compression and Encoding

Linux File Compression
Archiving With Tar
Compression With Gzip
Compress and Zcat
Zmore and Zless
Zip and Unzip
Encoding and Decoding
Encryption

Linux Does DOS

Accesing DOS Files
Accesing DOS Partitions
Running DOS Programs

Managing Linux

Updating Your Linux System
Installing Packages with RPM
Uninstalling Packages w/ RPM
Upgrading Packages with RPM
Querying Packages with RPM

AltStyle によって変換されたページ (->オリジナル) /