以下某些命令用于网络数据传输和分析,以及追查垃圾邮件发送者。
使用 DNS 按名称或 IP 地址搜索有关 Internet 主机的信息。
bash$ host surfacemail.com surfacemail.com. has address 202.92.42.236 |
显示主机的 IP 信息。使用-h选项,ipcalc 执行反向 DNS 查找,从 IP 地址查找主机(服务器)的名称。
bash$ ipcalc -h 202.92.42.236 HOSTNAME=surfacemail.com |
对主机按 IP 地址执行 Internet "名称服务器查找"。这本质上等同于 ipcalc -h 或 dig -x 。该命令可以交互式或非交互式运行,即从脚本内部运行。
nslookup 命令据称已被"弃用",但仍然有用。
bash$ nslookup -sil 66.97.104.180 nslookup kuhleersparnis.ch Server: 135.116.137.2 Address: 135.116.137.2#53 Non-authoritative answer: Name: kuhleersparnis.ch |
Domain Information Groper (域名信息搜索器)。类似于 nslookup, dig 对主机执行 Internet 名称服务器查找。可以从命令行或脚本内部运行。
dig 的一些有趣的选项是+time=N用于将查询超时设置为N秒,+nofail用于继续查询服务器直到收到回复,以及-x用于执行反向地址查找。
比较 dig -x 与 ipcalc -h 和 nslookup 的输出。
bash$ dig -x 81.9.6.2 ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 11649 ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0 ;; QUESTION SECTION: ;2.6.9.81.in-addr.arpa. IN PTR ;; AUTHORITY SECTION: 6.9.81.in-addr.arpa. 3600 IN SOA ns.eltel.net. noc.eltel.net. 2002031705 900 600 86400 3600 ;; Query time: 537 msec ;; SERVER: 135.116.137.2#53(135.116.137.2) ;; WHEN: Wed Jun 26 08:35:24 2002 ;; MSG SIZE rcvd: 91 |
示例 16-40. 找出向哪里报告垃圾邮件发送者
#!/bin/bash # spam-lookup.sh: Look up abuse contact to report a spammer. # Thanks, Michael Zick. # Check for command-line arg. ARGCOUNT=1 E_WRONGARGS=85 if [ $# -ne "$ARGCOUNT" ] then echo "Usage: `basename $0` domain-name" exit $E_WRONGARGS fi dig +short $1.contacts.abuse.net -c in -t txt # Also try: # dig +nssearch $1 # Tries to find "authoritative name servers" and display SOA records. # The following also works: # whois -h whois.abuse.net $1 # ^^ ^^^^^^^^^^^^^^^ Specify host. # Can even lookup multiple spammers with this, i.e." # whois -h whois.abuse.net $spamdomain1 $spamdomain2 . . . # Exercise: # -------- # Expand the functionality of this script #+ so that it automatically e-mails a notification #+ to the responsible ISP's contact address(es). # Hint: use the "mail" command. exit $? # spam-lookup.sh chinatietong.com # A known spam domain. # "crnet_mgr@chinatietong.com" # "crnet_tec@chinatietong.com" # "postmaster@chinatietong.com" # For a more elaborate version of this script, #+ see the SpamViz home page, http://www.spamviz.net/index.html. |
示例 16-41. 分析垃圾邮件域名
#! /bin/bash
# is-spammer.sh: Identifying spam domains
# $Id: is-spammer, v 1.4 2004/09/01 19:37:52 mszick Exp $
# Above line is RCS ID info.
#
# This is a simplified version of the "is_spammer.bash
#+ script in the Contributed Scripts appendix.
# is-spammer <domain.name>
# Uses an external program: 'dig'
# Tested with version: 9.2.4rc5
# Uses functions.
# Uses IFS to parse strings by assignment into arrays.
# And even does something useful: checks e-mail blacklists.
# Use the domain.name(s) from the text body:
# http://www.good_stuff.spammer.biz/just_ignore_everything_else
# ^^^^^^^^^^^
# Or the domain.name(s) from any e-mail address:
# Really_Good_Offer@spammer.biz
#
# as the only argument to this script.
#(PS: have your Inet connection running)
#
# So, to invoke this script in the above two instances:
# is-spammer.sh spammer.biz
# Whitespace == :Space:Tab:Line Feed:Carriage Return:
WSP_IFS=$'\x20'$'\x09'$'\x0A'$'\x0D'
# No Whitespace == Line Feed:Carriage Return
No_WSP=$'\x0A'$'\x0D'
# Field separator for dotted decimal ip addresses
ADR_IFS=${No_WSP}'.'
# Get the dns text resource record.
# get_txt <error_code> <list_query>
get_txt() {
# Parse $1 by assignment at the dots.
local -a dns
IFS=$ADR_IFS
dns=( $1 )
IFS=$WSP_IFS
if [ "${dns[0]}" == '127' ]
then
# See if there is a reason.
echo $(dig +short $2 -t txt)
fi
}
# Get the dns address resource record.
# chk_adr <rev_dns> <list_server>
chk_adr() {
local reply
local server
local reason
server=${1}${2}
reply=$( dig +short ${server} )
# If reply might be an error code . . .
if [ ${#reply} -gt 6 ]
then
reason=$(get_txt ${reply} ${server} )
reason=${reason:-${reply}}
fi
echo ${reason:-' not blacklisted.'}
}
# Need to get the IP address from the name.
echo 'Get address of: '$1
ip_adr=$(dig +short $1)
dns_reply=${ip_adr:-' no answer '}
echo ' Found address: '${dns_reply}
# A valid reply is at least 4 digits plus 3 dots.
if [ ${#ip_adr} -gt 6 ]
then
echo
declare query
# Parse by assignment at the dots.
declare -a dns
IFS=$ADR_IFS
dns=( ${ip_adr} )
IFS=$WSP_IFS
# Reorder octets into dns query order.
rev_dns="${dns[3]}"'.'"${dns[2]}"'.'"${dns[1]}"'.'"${dns[0]}"'.'
# See: http://www.spamhaus.org (Conservative, well maintained)
echo -n 'spamhaus.org says: '
echo $(chk_adr ${rev_dns} 'sbl-xbl.spamhaus.org')
# See: http://ordb.org (Open mail relays)
echo -n ' ordb.org says: '
echo $(chk_adr ${rev_dns} 'relays.ordb.org')
# See: http://www.spamcop.net/ (You can report spammers here)
echo -n ' spamcop.net says: '
echo $(chk_adr ${rev_dns} 'bl.spamcop.net')
# # # other blacklist operations # # #
# See: http://cbl.abuseat.org.
echo -n ' abuseat.org says: '
echo $(chk_adr ${rev_dns} 'cbl.abuseat.org')
# See: http://dsbl.org/usage (Various mail relays)
echo
echo 'Distributed Server Listings'
echo -n ' list.dsbl.org says: '
echo $(chk_adr ${rev_dns} 'list.dsbl.org')
echo -n ' multihop.dsbl.org says: '
echo $(chk_adr ${rev_dns} 'multihop.dsbl.org')
echo -n 'unconfirmed.dsbl.org says: '
echo $(chk_adr ${rev_dns} 'unconfirmed.dsbl.org')
else
echo
echo 'Could not use that address.'
fi
exit 0
# Exercises:
# --------
# 1) Check arguments to script,
# and exit with appropriate error message if necessary.
# 2) Check if on-line at invocation of script,
# and exit with appropriate error message if necessary.
# 3) Substitute generic variables for "hard-coded" BHL domains.
# 4) Set a time-out for the script using the "+time=" option
to the 'dig' command. |
有关上述脚本的更详细版本,请参阅示例 A-28。
跟踪发送到远程主机的数据包所经过的路由。此命令在 LAN、WAN 或 Internet 中均可工作。远程主机可以通过 IP 地址指定。此命令的输出可以通过管道中的 grep 或 sed 进行过滤。
bash$ traceroute 81.9.6.2 traceroute to 81.9.6.2 (81.9.6.2), 30 hops max, 38 byte packets 1 tc43.xjbnnbrb.com (136.30.178.8) 191.303 ms 179.400 ms 179.767 ms 2 or0.xjbnnbrb.com (136.30.178.1) 179.536 ms 179.534 ms 169.685 ms 3 192.168.11.101 (192.168.11.101) 189.471 ms 189.556 ms * ... |
向另一台机器广播ICMP ECHO_REQUEST数据包,无论是在本地网络还是远程网络上。这是一种用于测试网络连接的诊断工具,应谨慎使用。
bash$ ping localhost PING localhost.localdomain (127.0.0.1) from 127.0.0.1 : 56(84) bytes of data. 64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=0 ttl=255 time=709 usec 64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=1 ttl=255 time=286 usec --- localhost.localdomain ping statistics --- 2 packets transmitted, 2 packets received, 0% packet loss round-trip min/avg/max/mdev = 0.286/0.497/0.709/0.212 ms |
成功的 ping 返回 退出状态 0。这可以在脚本中进行测试。
HNAME=news-15.net # Notorious spammer. # HNAME=$HOST # Debug: test for localhost. count=2 # Send only two pings. if [[ `ping -c $count "$HNAME"` ]] then echo ""$HNAME" still up and broadcasting spam your way." else echo ""$HNAME" seems to be down. Pity." fi |
执行 DNS (域名系统) 查找。-h选项允许指定要查询的特定 whois 服务器。请参阅示例 4-6 和 示例 16-40。
检索有关网络上用户的信息。可选地,此命令可以显示用户的~/.plan, ~/.project和~/.forward文件(如果存在)。
bash$ finger Login Name Tty Idle Login Time Office Office Phone bozo Bozo Bozeman tty1 8 Jun 25 16:59 (:0) bozo Bozo Bozeman ttyp0 Jun 25 16:59 (:0.0) bozo Bozo Bozeman ttyp1 Jun 25 17:07 (:0.0) bash$ finger bozo Login: bozo Name: Bozo Bozeman Directory: /home/bozo Shell: /bin/bash Office: 2355 Clown St., 543-1234 On since Fri Aug 31 20:13 (MST) on tty1 1 hour 38 minutes idle On since Fri Aug 31 20:13 (MST) on pts/0 12 seconds idle On since Fri Aug 31 20:13 (MST) on pts/1 On since Fri Aug 31 20:31 (MST) on pts/2 1 hour 16 minutes idle Mail last read Tue Jul 3 10:08 2007 (MST) No Plan. |
出于安全考虑,许多网络禁用 finger 及其关联的守护进程。[1]
更改 finger 命令公开的信息。
验证 Internet 电子邮件地址。
此命令似乎在新版本的 Linux 发行版中已丢失。
sx 和 rx 命令集用于使用 xmodem 协议在远程主机之间传输文件。这些通常是通信软件包的一部分,例如 minicom。
sz 和 rz 命令集用于使用 zmodem 协议在远程主机之间传输文件。Zmodem 比 xmodem 有一些优势,例如更快的传输速率和恢复中断的文件传输。与 sx 和 rx 一样,这些通常是通信软件包的一部分。
用于上传/下载文件到远程主机或从远程主机下载文件的实用程序和协议。ftp 会话可以在脚本中自动化(请参阅示例 19-6 和 示例 A-4)。
uucp: UNIX to UNIX copy (UNIX 到 UNIX 复制)。这是一个用于在 UNIX 服务器之间传输文件的通信软件包。Shell 脚本是处理 uucp 命令序列的有效方法。
自从 Internet 和电子邮件出现以来,uucp 似乎已经淡出人们的视线,但它仍然存在,并且在 Internet 连接不可用或不适用的情况下仍然完全可行。uucp 的优点是它具有容错能力,因此即使服务中断,复制操作也会在连接恢复时从中断处继续。
---
uux: UNIX to UNIX execute (UNIX 到 UNIX 执行)。在远程系统上执行命令。此命令是 uucp 软件包的一部分。
---
cu: Call Up (呼叫) 远程系统并作为简单终端连接。它是 telnet 的一种简化版本。此命令是 uucp 软件包的一部分。
用于连接到远程主机的实用程序和协议。
![]() | telnet 协议包含安全漏洞,因此可能应该避免使用。不建议在 shell 脚本中使用它。 |
wget 实用程序非交互式地从 Web 或 ftp 站点检索或下载文件。它在脚本中运行良好。
wget -p http://www.xyz23.com/file01.html # The -p or --page-requisite option causes wget to fetch all files #+ required to display the specified page. wget -r ftp://ftp.xyz24.net/~bozo/project_files/ -O $SAVEFILE # The -r option recursively follows and retrieves all links #+ on the specified site. wget -c ftp://ftp.xyz25.net/bozofiles/filename.tar.bz2 # The -c option lets wget resume an interrupted download. # This works with ftp servers and many HTTP sites. |
示例 16-42. 获取股票报价
#!/bin/bash
# quote-fetch.sh: Download a stock quote.
E_NOPARAMS=86
if [ -z "$1" ] # Must specify a stock (symbol) to fetch.
then echo "Usage: `basename $0` stock-symbol"
exit $E_NOPARAMS
fi
stock_symbol=$1
file_suffix=.html
# Fetches an HTML file, so name it appropriately.
URL='http://finance.yahoo.com/q?s='
# Yahoo finance board, with stock query suffix.
# -----------------------------------------------------------
wget -O ${stock_symbol}${file_suffix} "${URL}${stock_symbol}"
# -----------------------------------------------------------
# To look up stuff on http://search.yahoo.com:
# -----------------------------------------------------------
# URL="http://search.yahoo.com/search?fr=ush-news&p=${query}"
# wget -O "$savefilename" "${URL}"
# -----------------------------------------------------------
# Saves a list of relevant URLs.
exit $?
# Exercises:
# ---------
#
# 1) Add a test to ensure the user running the script is on-line.
# (Hint: parse the output of 'ps -ax' for "ppp" or "connect."
#
# 2) Modify this script to fetch the local weather report,
#+ taking the user's zip code as an argument. |
lynx Web 和文件浏览器可以在脚本内部使用(使用-dump选项)以非交互方式从 Web 或 ftp 站点检索文件。
lynx -dump http://www.xyz23.com/file01.html >$SAVEFILE |
使用-traversal选项,lynx 从作为参数指定的 HTTP URL 开始,然后"爬取"该特定服务器上的所有链接。与-crawl选项一起使用,将页面文本输出到日志文件。
远程登录,在远程主机上启动会话。此命令存在安全问题,因此请改用 ssh。
远程 shell,在远程主机上执行命令。这存在安全问题,因此请改用 ssh。
远程复制,在两台不同的联网机器之间复制文件。
远程同步,更新(同步)两台不同的联网机器之间的文件。
bash$ rsync -a ~/sourcedir/*txt /node1/subdirectory/ |
示例 16-43. 更新 FC4
#!/bin/bash
# fc4upd.sh
# Script author: Frank Wang.
# Slight stylistic modifications by ABS Guide author.
# Used in ABS Guide with permission.
# Download Fedora Core 4 update from mirror site using rsync.
# Should also work for newer Fedora Cores -- 5, 6, . . .
# Only download latest package if multiple versions exist,
#+ to save space.
URL=rsync://distro.ibiblio.org/fedora-linux-core/updates/
# URL=rsync://ftp.kddilabs.jp/fedora/core/updates/
# URL=rsync://rsync.planetmirror.com/fedora-linux-core/updates/
DEST=${1:-/var/www/html/fedora/updates/}
LOG=/tmp/repo-update-$(/bin/date +%Y-%m-%d).txt
PID_FILE=/var/run/${0##*/}.pid
E_RETURN=85 # Something unexpected happened.
# General rsync options
# -r: recursive download
# -t: reserve time
# -v: verbose
OPTS="-rtv --delete-excluded --delete-after --partial"
# rsync include pattern
# Leading slash causes absolute path name match.
INCLUDE=(
"/4/i386/kde-i18n-Chinese*"
# ^ ^
# Quoting is necessary to prevent globbing.
)
# rsync exclude pattern
# Temporarily comment out unwanted pkgs using "#" . . .
EXCLUDE=(
/1
/2
/3
/testing
/4/SRPMS
/4/ppc
/4/x86_64
/4/i386/debug
"/4/i386/kde-i18n-*"
"/4/i386/openoffice.org-langpack-*"
"/4/i386/*i586.rpm"
"/4/i386/GFS-*"
"/4/i386/cman-*"
"/4/i386/dlm-*"
"/4/i386/gnbd-*"
"/4/i386/kernel-smp*"
# "/4/i386/kernel-xen*"
# "/4/i386/xen-*"
)
init () {
# Let pipe command return possible rsync error, e.g., stalled network.
set -o pipefail # Newly introduced in Bash, version 3.
TMP=${TMPDIR:-/tmp}/${0##*/}.$$ # Store refined download list.
trap "{
rm -f $TMP 2>/dev/null
}" EXIT # Clear temporary file on exit.
}
check_pid () {
# Check if process exists.
if [ -s "$PID_FILE" ]; then
echo "PID file exists. Checking ..."
PID=$(/bin/egrep -o "^[[:digit:]]+" $PID_FILE)
if /bin/ps --pid $PID &>/dev/null; then
echo "Process $PID found. ${0##*/} seems to be running!"
/usr/bin/logger -t ${0##*/} \
"Process $PID found. ${0##*/} seems to be running!"
exit $E_RETURN
fi
echo "Process $PID not found. Start new process . . ."
fi
}
# Set overall file update range starting from root or $URL,
#+ according to above patterns.
set_range () {
include=
exclude=
for p in "${INCLUDE[@]}"; do
include="$include --include \"$p\""
done
for p in "${EXCLUDE[@]}"; do
exclude="$exclude --exclude \"$p\""
done
}
# Retrieve and refine rsync update list.
get_list () {
echo $$ > $PID_FILE || {
echo "Can't write to pid file $PID_FILE"
exit $E_RETURN
}
echo -n "Retrieving and refining update list . . ."
# Retrieve list -- 'eval' is needed to run rsync as a single command.
# $3 and $4 is the date and time of file creation.
# $5 is the full package name.
previous=
pre_file=
pre_date=0
eval /bin/nice /usr/bin/rsync \
-r $include $exclude $URL | \
egrep '^dr.x|^-r' | \
awk '{print $3, $4, $5}' | \
sort -k3 | \
{ while read line; do
# Get seconds since epoch, to filter out obsolete pkgs.
cur_date=$(date -d "$(echo $line | awk '{print $1, $2}')" +%s)
# echo $cur_date
# Get file name.
cur_file=$(echo $line | awk '{print $3}')
# echo $cur_file
# Get rpm pkg name from file name, if possible.
if [[ $cur_file == *rpm ]]; then
pkg_name=$(echo $cur_file | sed -r -e \
's/(^([^_-]+[_-])+)[[:digit:]]+\..*[_-].*$/\1/')
else
pkg_name=
fi
# echo $pkg_name
if [ -z "$pkg_name" ]; then # If not a rpm file,
echo $cur_file >> $TMP #+ then append to download list.
elif [ "$pkg_name" != "$previous" ]; then # A new pkg found.
echo $pre_file >> $TMP # Output latest file.
previous=$pkg_name # Save current.
pre_date=$cur_date
pre_file=$cur_file
elif [ "$cur_date" -gt "$pre_date" ]; then
# If same pkg, but newer,
pre_date=$cur_date #+ then update latest pointer.
pre_file=$cur_file
fi
done
echo $pre_file >> $TMP # TMP contains ALL
#+ of refined list now.
# echo "subshell=$BASH_SUBSHELL"
} # Bracket required here to let final "echo $pre_file >> $TMP"
# Remained in the same subshell ( 1 ) with the entire loop.
RET=$? # Get return code of the pipe command.
[ "$RET" -ne 0 ] && {
echo "List retrieving failed with code $RET"
exit $E_RETURN
}
echo "done"; echo
}
# Real rsync download part.
get_file () {
echo "Downloading..."
/bin/nice /usr/bin/rsync \
$OPTS \
--filter "merge,+/ $TMP" \
--exclude '*' \
$URL $DEST \
| /usr/bin/tee $LOG
RET=$?
# --filter merge,+/ is crucial for the intention.
# + modifier means include and / means absolute path.
# Then sorted list in $TMP will contain ascending dir name and
#+ prevent the following --exclude '*' from "shortcutting the circuit."
echo "Done"
rm -f $PID_FILE 2>/dev/null
return $RET
}
# -------
# Main
init
check_pid
set_range
get_list
get_file
RET=$?
# -------
if [ "$RET" -eq 0 ]; then
/usr/bin/logger -t ${0##*/} "Fedora update mirrored successfully."
else
/usr/bin/logger -t ${0##*/} \
"Fedora update mirrored with failure code: $RET"
fi
exit $RET |
另请参阅 示例 A-32。
安全 shell,登录到远程主机并在那里执行命令。这种安全的 telnet、rlogin、rcp 和 rsh 替代品使用身份验证和加密。有关详细信息,请参阅其 manpage。
示例 16-44. 使用 ssh
#!/bin/bash
# remote.bash: Using ssh.
# This example by Michael Zick.
# Used with permission.
# Presumptions:
# ------------
# fd-2 isn't being captured ( '2>/dev/null' ).
# ssh/sshd presumes stderr ('2') will display to user.
#
# sshd is running on your machine.
# For any 'standard' distribution, it probably is,
#+ and without any funky ssh-keygen having been done.
# Try ssh to your machine from the command-line:
#
# $ ssh $HOSTNAME
# Without extra set-up you'll be asked for your password.
# enter password
# when done, $ exit
#
# Did that work? If so, you're ready for more fun.
# Try ssh to your machine as 'root':
#
# $ ssh -l root $HOSTNAME
# When asked for password, enter root's, not yours.
# Last login: Tue Aug 10 20:25:49 2004 from localhost.localdomain
# Enter 'exit' when done.
# The above gives you an interactive shell.
# It is possible for sshd to be set up in a 'single command' mode,
#+ but that is beyond the scope of this example.
# The only thing to note is that the following will work in
#+ 'single command' mode.
# A basic, write stdout (local) command.
ls -l
# Now the same basic command on a remote machine.
# Pass a different 'USERNAME' 'HOSTNAME' if desired:
USER=${USERNAME:-$(whoami)}
HOST=${HOSTNAME:-$(hostname)}
# Now excute the above command-line on the remote host,
#+ with all transmissions encrypted.
ssh -l ${USER} ${HOST} " ls -l "
# The expected result is a listing of your username's home
#+ directory on the remote machine.
# To see any difference, run this script from somewhere
#+ other than your home directory.
# In other words, the Bash command is passed as a quoted line
#+ to the remote shell, which executes it on the remote machine.
# In this case, sshd does ' bash -c "ls -l" ' on your behalf.
# For information on topics such as not having to enter a
#+ password/passphrase for every command-line, see
#+ man ssh
#+ man ssh-keygen
#+ man sshd_config.
exit 0 |
![]() | 在循环中,ssh 可能会导致意外行为。根据 comp.unix shell 存档中的 Usenet 帖子,ssh 继承了循环的stdin。为了解决这个问题,请将 ssh 传递-n或-f选项。 感谢 Jason Bechtel 指出这一点。 |
安全复制,功能类似于 rcp,在两台不同的联网机器之间复制文件,但使用身份验证,并且具有类似于 ssh 的安全级别。
这是一个用于终端到终端通信的实用程序。它允许将来自您的终端(控制台或 xterm)的行发送到另一用户的终端。mesg 命令当然可以用来禁用对终端的写入访问
由于 write 是交互式的,因此通常不会在脚本中使用它。
一个用于配置网络适配器(使用 DHCP)的命令行实用程序。此命令是 Red Hat 中心 Linux 发行版所特有的。
发送或读取电子邮件消息。
这个精简的命令行邮件客户端可以很好地作为嵌入在脚本中的命令使用。
示例 16-45. 一个给自己发送邮件的脚本
#!/bin/sh
# self-mailer.sh: Self-mailing script
adr=${1:-`whoami`} # Default to current user, if not specified.
# Typing 'self-mailer.sh wiseguy@superdupergenius.com'
#+ sends this script to that addressee.
# Just 'self-mailer.sh' (no argument) sends the script
#+ to the person invoking it, for example, bozo@localhost.localdomain.
#
# For more on the ${parameter:-default} construct,
#+ see the "Parameter Substitution" section
#+ of the "Variables Revisited" chapter.
# ============================================================================
cat $0 | mail -s "Script \"`basename $0`\" has mailed itself to you." "$adr"
# ============================================================================
# --------------------------------------------
# Greetings from the self-mailing script.
# A mischievous person has run this script,
#+ which has caused it to mail itself to you.
# Apparently, some people have nothing better
#+ to do with their time.
# --------------------------------------------
echo "At `date`, script \"`basename $0`\" mailed to "$adr"."
exit 0
# Note that the "mailx" command (in "send" mode) may be substituted
#+ for "mail" ... but with somewhat different options. |
类似于 mail 命令,mailto 从命令行或脚本发送电子邮件消息。但是,mailto 还允许发送 MIME (多媒体) 消息。
显示邮件统计信息。此命令只能由 root 调用。
root# mailstats Statistics from Tue Jan 1 20:32:08 2008 M msgsfr bytes_from msgsto bytes_to msgsrej msgsdis msgsqur Mailer 4 1682 24118K 0 0K 0 0 0 esmtp 9 212 640K 1894 25131K 0 0 0 local ===================================================================== T 1894 24758K 1894 25131K 0 0 0 C 414 0 |
此实用程序自动回复电子邮件,告知预期收件人正在休假且暂时无法访问。它在网络上与 sendmail 结合运行,不适用于拨号 POPmail 帐户。
| [1] | 守护进程是一个未附加到终端会话的后台进程。守护进程在指定时间执行指定的服务,或由某些事件显式触发。 单词 "daemon" 在希腊语中意为幽灵,而 UNIX 守护进程在幕后游荡,默默地执行其指定的任务的方式确实有些神秘,几乎是超自然的。 |