mail命令进入系统自带的MAIL
[root@mylinux ~]# mail
Mail version 8.1 6/6/93. Type ? for help.
"/var/spool/mail/root": 2 messages 2 new
>N 1
root@localhost.local Mon Dec 31 04:02 67/2018 "LogWatch for mylinux"
N 2
root@localhost.local Sun Jan 6 04:02 53/1689 "LogWatch for mylinux"
& help //进入帮助
Mail Commands
t <message list> type messages //程序调用more显示消息,后接单个消息号或是一个范围,如t 1 或者t 1-2
n goto and type next message //显示下一条消息,常用
e <message list> edit messages //程序会调用vi编辑消息
f <message list> give head lines of messages //给出指定消息的消息头
d <message list> delete messages //删除消息,并没有实际删除
s <message list> file append messages to file //将消息附加到指定文件后
u <message list> undelete messages //还原删除的消息
R <message list> reply to message senders //回复邮件
r <message list> reply to message senders and all recipients //回复邮件给发送者与其它接收者
pre <message list> make messages go back to /usr/spool/mail //将邮件放回/usr/spool/mail,其实邮件本来就在这个目录,但当你阅读后,保存退出,邮件会转移,并附加到/root/mbox这个文件里
m <user list> mail to specific users //将邮件发给特定用户
q quit, saving unresolved messages in mbox //退出,保存未处理的邮件
x quit, do not remove system mailbox //退出,不从/usr/spool/mail删除已处理的邮件
h print out active message headers //显示活动的邮件头,常用
! shell escape //打印!
cd [directory] chdir to directory or home if none given //改变当前工作目录
A <message list> consists of integers, ranges of same, or user names separated
by spaces. If omitted, Mail uses the last message typed.
邮件列表可以是以空格隔开的单个邮件,连续的邮件,或指定用户的邮件,如果缺省,MAIL会使用最近显示的邮件
A <user list> consists of user names or aliases separated by spaces.
Aliases are defined in .mailrc in your home directory.
用户列表可以是以空格隔开的用户名或别名.别名在主目录的.mailrc文件里定义
&