mail的收发
[root@mycentos ~]# mail -s "1st mail" wwy=======发送第一封邮件
hell wwy w^H
ciscobbsnas ccnp
.
Cc:
[root@mycentos ~]# touch test.mail
[root@mycentos ~]# vi test.mail
jdlsjdlfjlsjdlfjs
lsjdfljsldjf
sljdfljsd
lsjdfljsl
"test.mail" 4L, 51C written
[root@mycentos ~]# ls
1985calendar ciscobbs install.log.syslog test11.12
1998calendar cisco.out ls.out test.mail
1999calendar cisco.txt myfile tmp
1.txt cut.csv rootcisco who.out
2009 cut.tab sort.out wwycisco
account.err dstamp test11 wwycron
anaconda-ks.cfg grep.err test1.11
cisco install.log test11.11
[root@mycentos ~]# mail -s "2nd mail" wwy < test.mail==发送第二封邮件
阅读邮件==============================================================
[wwy@mycentos ~]$ cat /var/spool/mail/wwy============邮件目录
From
[email protected] Wed May 20 11:49:51 2009
Return-Path: <
[email protected]>
Received: from localhost.localdomain (mycentos [127.0.0.1])
by localhost.localdomain (8.13.8/8.13.8) with ESMTP id n4K3nooP003661
for <
[email protected]>; Wed, 20 May 2009 11:49:51 +0800
Received: (from root@localhost)
by localhost.localdomain (8.13.8/8.13.8/Submit) id n4K3no4g003660
for wwy; Wed, 20 May 2009 11:49:50 +0800
Date: Wed, 20 May 2009 11:49:50 +0800
From: root <
[email protected]>
Message-Id: <
[email protected]>
To:
[email protected]
Subject: 1st mail
hell wwy w ===============第一封邮件
ciscobbsnas ccnp
From
[email protected] Wed May 20 11:50:41 2009
Return-Path: <
[email protected]>
Received: from localhost.localdomain (mycentos [127.0.0.1])
by localhost.localdomain (8.13.8/8.13.8) with ESMTP id n4K3oead003670
for <
[email protected]>; Wed, 20 May 2009 11:50:41 +0800
Received: (from root@localhost)
by localhost.localdomain (8.13.8/8.13.8/Submit) id n4K3oe3E003669
for wwy; Wed, 20 May 2009 11:50:40 +0800
Date: Wed, 20 May 2009 11:50:40 +0800
From: root <
[email protected]>
Message-Id: <
[email protected]>
To:
[email protected]
Subject: 2nd mail=========================第二封邮件
jdlsjdlfjlsjdlfjs
lsjdfljsldjf
sljdfljsd
lsjdfljsl
[wwy@mycentos ~]$ mail =======================查看收到的邮件
Mail version 8.1 6/6/93. Type ? for help.
"/var/spool/mail/wwy": 2 messages 2 new
>N 1
[email protected] Wed May 20 11:49 17/659 "1st ma"
N 2
[email protected] Wed May 20 11:50 19/681 "2nd ma"
& 2=============================选择查看的邮件编号
Message 2:
From
[email protected] Wed May 20 11:50:41 2009
Date: Wed, 20 May 2009 11:50:40 +0800
From: root <
[email protected]>
To:
[email protected]
Subject: 2nd mail
jdlsjdlfjlsjdlfjs
lsjdfljsldjf
sljdfljsd
lsjdfljsl
& q==========================阅读过的邮件会存放在/home/user/mbox
Saved 1 message in mbox
Held 1 message in /var/spool/mail/wwy
[wwy@mycentos ~]$ mail
Mail version 8.1 6/6/93. Type ? for help.
"/var/spool/mail/wwy": 1 message 1 unread
>U 1
[email protected] Wed May 20 11:49 18/669 "1st ma"
&
[wwy@mycentos ~]$ cat ~wwy/mbox===============阅读完的邮件存放地
From
[email protected] Wed May 20 11:50:41 2009
Return-Path: <
[email protected]>
Received: from localhost.localdomain (mycentos [127.0.0.1])
by localhost.localdomain (8.13.8/8.13.8) with ESMTP id n4K3oead003670
for <
[email protected]>; Wed, 20 May 2009 11:50:41 +0800
Received: (from root@localhost)
by localhost.localdomain (8.13.8/8.13.8/Submit) id n4K3oe3E003669
for wwy; Wed, 20 May 2009 11:50:40 +0800
Date: Wed, 20 May 2009 11:50:40 +0800
From: root <
[email protected]>
Message-Id: <
[email protected]>
To:
[email protected]
Subject: 2nd mail
Status: RO
jdlsjdlfjlsjdlfjs
lsjdfljsldjf
sljdfljsd
lsjdfljsl
From
[email protected] Wed May 20 11:49:51 2009
Return-Path: <
[email protected]>
Received: from localhost.localdomain (mycentos [127.0.0.1])
by localhost.localdomain (8.13.8/8.13.8) with ESMTP id n4K3nooP003661
for <
[email protected]>; Wed, 20 May 2009 11:49:51 +0800
Received: (from root@localhost)
by localhost.localdomain (8.13.8/8.13.8/Submit) id n4K3no4g003660
for wwy; Wed, 20 May 2009 11:49:50 +0800
Date: Wed, 20 May 2009 11:49:50 +0800
From: root <
[email protected]>
Message-Id: <
[email protected]>
To:
[email protected]
Subject: 1st mail
Status: RO
hell wwy w
ciscobbsnas ccnp
-----------------------------------------------------------------------
[root@mycentos ~]# ls -l |mail -s "3rd mail" wwy===================将此列表导入到mail
[root@mycentos ~]# su wwy
[wwy@mycentos ~]$ mail
Mail version 8.1 6/6/93. Type ? for help.
"/var/spool/mail/wwy": 1 message 1 new
>N 1
[email protected] Wed May 20 12:03 46/2184 "3rd ma"
& 1
Message 1:
From
[email protected] Wed May 20 12:03:04 2009
Date: Wed, 20 May 2009 12:03:03 +0800
From: root <
[email protected]>
To:
[email protected]
Subject: 3rd mail
total 228
-rwxr-xr-x 1 root root 2023 May 17 11:53 1985calendar
-rw-r--r-- 1 root root 1968 May 17 14:10 1998calendar
-r-Srwsrwt 1 root root 1959 May 17 14:12 1999calendar
-rw------- 1 root root 0 Apr 28 15:04 1.txt
-rw-r--r-- 1 root root 150 May 20 11:05 2009
-rw-r--r-- 1 root root 0 May 19 16:03 account.err
-rw------- 1 root root 870 Apr 27 21:49 anaconda-ks.cfg
drwxrwxr-x 2 root root 4096 May 18 15:25 cisco
-rw-r--r-- 1 root root 0 May 19 15:51 ciscobbs
-rw-r--r-- 1 root root 10 May 19 15:58 cisco.out
-rw-r--r-- 1 root root 10 May 19 15:16 cisco.txt
-rw-r--r-- 1 root root 143 May 20 11:39 cut.csv
-rw-r--r-- 1 root root 111 May 20 11:41 cut.tab
-rw-r--r-- 1 root root 0 May 19 21:40 dstamp
-rw-r--r-- 1 root root 42 May 19 16:02 grep.err
-rw-r--r-- 1 root root 20048 Apr 27 21:49 install.log
-rw-r--r-- 1 root root 3049 Apr 27 21:48 install.log.syslog
-rw-r--r-- 1 root root 209 May 19 15:51 ls.out
-rw-r--r-- 1 root root 52 May 19 14:46 myfile
drwxr-xr-x 2 root root 4096 May 18 13:39 rootcisco
-rw-r--r-- 1 root root 1778 May 19 15:50 sort.out
drwxr-xr-x 2 root root 4096 May 18 15:10 test11
-rw-r--r-- 1 root root 0 May 18 15:09 test1.11
-rw-r--r-- 1 root root 0 May 18 15:24 test11.11
-rw-rw-r-- 1 root root 0 May 18 15:25 test11.12
-rw-r--r-- 1 root root 51 May 20 11:50 test.mail
drwxr-xr-x 2 root root 4096 May 20 10:43 tmp
-rw-r--r-- 1 root root 94 May 19 15:27 who.out
drwxr-xr-x 2 root wwy 4096 May 18 13:38 wwycisco
-rwxrwxrwx 1 root root 48 May 18 15:54 wwycron
& x
[wwy@mycentos ~]$
-------------------------------------------------------------
cat cd.txt | xargs rm -f
ls -l | lpr
[root@mycentos ~]# cut -f1 -d: /etc/passwd |sort |less
adm
avahi
avahi-autoipd
bin
cisco
daemon
dbus
ftp
games
gopher
haldaemon
halt
lp
mail
mailnull
news
nfsnobody
nobody
nscd
operator
pcap
root
rpc
rpcuser
shutdown
smmsp
sshd
sync
u1
u2
uucp
vcsa
wwy
xfs
(END)
----------------------------------------------------------------------
tee 资料分流
[root@mycentos ~]# cut -f1 -d: /etc/passwd|tee cut.file |sort |tee sort.file |less
adm
avahi
avahi-autoipd
bin
cisco
daemon
dbus
ftp
games
gopher
haldaemon
halt
lp
mail
mailnull
news
nfsnobody
nobody
nscd
operator
pcap
root
rpc
rpcuser
shutdown
smmsp
sshd
sync
u1
u2
uucp
[root@mycentos ~]# ls -l
total 244
-rwxr-xr-x 1 root root 2023 May 17 11:53 1985calendar
-rw-r--r-- 1 root root 1968 May 17 14:10 1998calendar
-r-Srwsrwt 1 root root 1959 May 17 14:12 1999calendar
-rw------- 1 root root 0 Apr 28 15:04 1.txt
-rw-r--r-- 1 root root 150 May 20 11:05 2009
-rw-r--r-- 1 root root 0 May 19 16:03 account.err
-rw------- 1 root root 870 Apr 27 21:49 anaconda-ks.cfg
drwxrwxr-x 2 root root 4096 May 18 15:25 cisco
-rw-r--r-- 1 root root 0 May 19 15:51 ciscobbs
-rw-r--r-- 1 root root 10 May 19 15:58 cisco.out
-rw-r--r-- 1 root root 10 May 19 15:16 cisco.txt
-rw-r--r-- 1 root root 143 May 20 11:39 cut.csv
-rw-r--r-- 1 root root 202 May 20 12:10 cut.file
-rw-r--r-- 1 root root 111 May 20 11:41 cut.tab
-rw-r--r-- 1 root root 0 May 19 21:40 dstamp
-rw-r--r-- 1 root root 42 May 19 16:02 grep.err
-rw-r--r-- 1 root root 20048 Apr 27 21:49 install.log
-rw-r--r-- 1 root root 3049 Apr 27 21:48 install.log.syslog
-rw-r--r-- 1 root root 209 May 19 15:51 ls.out
-rw-r--r-- 1 root root 52 May 19 14:46 myfile
drwxr-xr-x 2 root root 4096 May 18 13:39 rootcisco
-rw-r--r-- 1 root root 202 May 20 12:10 sort.file
-rw-r--r-- 1 root root 1778 May 19 15:50 sort.out
drwxr-xr-x 2 root root 4096 May 18 15:10 test11
-rw-r--r-- 1 root root 0 May 18 15:09 test1.11
-rw-r--r-- 1 root root 0 May 18 15:24 test11.11
-rw-rw-r-- 1 root root 0 May 18 15:25 test11.12
-rw-r--r-- 1 root root 51 May 20 11:50 test.mail
drwxr-xr-x 2 root root 4096 May 20 10:43 tmp
-rw-r--r-- 1 root root 94 May 19 15:27 who.out
drwxr-xr-x 2 root wwy 4096 May 18 13:38 wwycisco
-rwxrwxrwx 1 root root 48 May 18 15:54 wwycron
[root@mycentos ~]# cat cut.file
root
bin
daemon
adm
lp
sync
shutdown
halt
mail
news
uucp
operator
games
gopher
ftp
nobody
rpc
mailnull
smmsp
nscd
vcsa
rpcuser
nfsnobody
sshd
pcap
dbus
haldaemon
avahi
avahi-autoipd
xfs
u1
u2
wwy
cisco
[root@mycentos ~]# cat sort.file
adm
avahi
avahi-autoipd
bin
cisco
daemon
dbus
ftp
games
gopher
haldaemon
halt
lp
mail
mailnull
news
nfsnobody
nobody
nscd
operator
pcap
root
rpc
rpcuser
shutdown
smmsp
sshd
sync
u1
u2
uucp
vcsa
wwy
xfs
本文出自 “www.51cto.com” 博客,谢绝转载!