Linux Classes
Share This With a Friend  

How Do I Read Email with Linux?

If you log in as hermie now (pressing alt-F2 to access another virtual console would be convenient), you'll be greeted with the following cheery little message: You have new mail.

You can receive and read your incoming email by using the mail command again.

Here's a sample mail session (text in bold is what you would enter):

$ mail

Mail version 5.6 6/1/95. Type ? for help.
"/var/spool/mail/hermie": 1 message 1 new
>N 1 [email protected] Mon Feb 10 14:58 "Gone Fishing"
>N 2 [email protected] Mon Feb 10 15:37 "Make Money Fast!"
N 3 [email protected] Mon Feb 10 15:37 "Tennis, Anyone?"
& 1
Message 1:
Date: Mon, 10 Feb 1997 14:58:12 -0500
From: [email protected]
To: [email protected]
Subject: Gone Fishing
I've decided to kick back this afternoon and go fishing.
So if this crazy Linux system rolls over and dies,
I suggest you do likewise.
& q
Saved 1 message in /home/hermie/mbox
Held 2 messages in /var/mail/spool/hermie

Let's look at what just happened. After you entered the mail command, the system informed you of the version of the mail program that is running and told you how to get help for it.

The next line tells you that there is one new message in your mailbox, and that your incoming mail is stored in the file /var/spool/mail/hermie. (Each user on the system has a mail file in the /var/spool/mail directory.) When new mail arrives, Linux tacks it onto the end of the recipient's mail file.

Note: You should never directly edit your mail file--always use mail or another email program to handle your mail. (If you're editing your mail file when a new message arrives, it will be lost.) But it's quite all right to scan your mail file with grep or some other utility that doesn't try to modify it. (You might want to apply grep to your mail to find a particular string, such as the email address of a person who has corresponded with you.)

The next line,

>N 1 [email protected] Mon Feb 10 14:58 "Gone Fishing"

is referred to as a header line, and it tells you a number of things. The > tells you which message is the current one--the one you're working with.

The N 1 indicates that you're dealing with message 1 and that it's flagged as a new message. (Later, the flag could be U for unread or O for an old message.) The rest of the line tells you who the message is from, when it was sent, and the Subject line.

The ampersand (&) on the following line is the mail prompt. In this example, we entered a 1 to display the first message, and the message text is shown on the lines that follow. Unfortunately, we can't tell from the context whether to roll over and die or just go fishing.

Previous Lesson: Sending Email
Next Lesson: Other Mail Commands



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

Rocky Kuang     (25 Sep 2014, 12:25)
logwatch is not able to send email out after changing MX record.
Nawal     (08 Apr 2012, 11:47)
after reading the messages of the mail, it doesn't get saved to mbox
what shall I do?
Vishal Gujadhur     (25 Jan 2011, 13:58)
Hi cane you plz hellp me to my mail as i cant open my mail THXXX...
bilal     (28 Aug 2010, 14:17)
Thanks Jorge, This problem is solved now :)
Jorge     (27 Aug 2010, 06:20)

./arm_v5t_le-gcc hello.c -o hello

the problem is that this command is not in the search path, so make sure you tell bash where it is, by giving absolute path, for instance, or relative path (as in my answer, where i assume your compiler is in the current directory)
Bilal     (01 May 2010, 05:46)

I need to execute simple C code after writing this code and saving it in particular directory mentioned in manual.I have run the following command to execute i.e.
host $ arm_v5t_le-gcc hello.c -o hello

but instead of executing this command successfully I am getthing following error:

bash: arm_v5t-le-gcc: command not found

can you please tell me what does this error means?

(Note:I am working on DSP video kit (by Texas Instruments)that came up with linux softwares.)


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.
Notify me about new comments on this page
Hide my email

Ask Bob Rankin - Free Tech Support

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