Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
my OS has two users root & lxuser.If I become root in terminal and run 'mail lxuser'(without quotes ofcourse).then how will lxuser come to know of mail.
MAILCHECK
Specifies how often (in seconds) bash checks for mail. The
default is 60 seconds. When it is time to check for mail, the
shell does so before displaying the primary prompt. If this
variable is unset, or set to a value that is not a number
greater than or equal to zero, the shell disables mail checking.
MAILPATH
A colon-separated list of file names to be checked for mail.
The message to be printed when mail arrives in a particular file
may be specified by separating the file name from the message
with a `?'. When used in the text of the message, $_ expands to
the name of the current mailfile. Example:
MAILPATH='/var/mail/bfox?"You have mail":~/shell-mail?"$_ has
mail!"'
Bash supplies a default value for this variable, but the loca-
tion of the user mail files that it uses is system dependent
(e.g., /var/mail/$USER).
I became root in terminal using 'su'(without quotes obviously)
Then I mailed user 'abhiluv' as follows
#mail abhiluv
Subject: hi
what is going on ? <pressed ctrl+d>
Cc: root
#ls -aps /var/mail
8 ./ 8 ../ 0 abhiluv 4 cdot 8 root 4 rpc
Sumeet, the mail should be there in the file /var/mail/abhiluv. You can view that either by using the command "cat /var/mail/abhiluv" or by entering the command "mail" from abhiluv's shell.
Eg:
[abhiluv@localhost ~]$ mail
Heirloom Mail version 12.4 7/29/08. Type ? for help.
"/var/spool/mail/abhiluv": 1 message
> 1 root Thu Dec 17 13:29 21/746 "hi"
&
Entering "1" will display the first e-mail for abhiluv.
If you prefer you can use other email clients like "pine" for viewing the e-mails.
in ubuntu 9.04 I installed
#apt-get install mailutils
Then I send mail to lxuser as root and it worked.
But why does it not happen RHEL 5.3
I have noticed that in both OS echo $MAILPATH returned nothing
so can't find mistake in RHEL 5.3 ?
Last edited by sumeet inani; 12-17-2009 at 03:33 AM.
in ubuntu 9.04 I installed
#apt-get install mailutils
Then I send mail to lxuser as root and it worked.
But why does it not happen RHEL 5.3
I have noticed that in both OS echo $MAILPATH returned nothing
so can't find mistake in RHEL 5.3 ?
Am i right?
I noticed that if I open terminal then message will come only after I run some command(like ls or anything)not by itself automatically.Can we colour the message so noticeable?
Or should I be contented to run 'mail' like we check in our yahoo,gmail etc. accounts with web browser
Last edited by sumeet inani; 12-22-2009 at 12:13 AM.
That's the way it works in Bash. The reason is that it doesn't want to interrupt you mid-command.
I keep looking for another easy way to monitor a changing file or directory. It seems to me that there ought to be some command line thing, but if there is, I don't know of it.
That has links for dnotify, inotify, changedfiles, watch, Gamin and fam. None of those directly do what you want, but any of them could be used to roll up something.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.