-------------man dmesg--------------------------
NAME
dmesg - print or control the kernel ring buffer
SYNOPSIS
dmesg [ -c ] [ -n level ] [ -s bufsize ]
DESCRIPTION
dmesg is used to examine or control the kernel ring buffer .
The program helps users to print out their bootup mes- sages. Instead of copying the messages by hand, the user need only:
………………
|
#who
chyang pts/0 Aug 18 15:06
ynguo pts/2 Aug 18 15:32
|
#w
3:36pm up 1 day, 22:34, 6 users, load average: 0.23, 0.29, 0.27
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
chyang pts/0 202.38.68.242 3:06pm 2:04 0.08s 0.04s -bash
|
#users
chyang lewis lewis ylou ynguo ynguo
|
#last
chyang pts/9 202.38.68.242 Tue Aug 1 08:34 - 11:23 (02:49)
cfan pts/6 202.38.64.224 Tue Aug 1 08:33 - 08:48 (00:14)
|
#last root
root pts/4 simba.nic.ustc.e Fri Aug 4 16:50 - 08:20 (15:30)
root pts/4 simba.nic.ustc.e Thu Aug 3 23:55 - 04:40 (04:44)
root pts/11 simba.nic.ustc.e Thu Aug 3 20:45 - 22:02 (01:16)
|
#ac
total 123.45
|
#ac -d
Aug 12 total 261.87
Aug 13 total 351.39
Aug 14 total 396.09
Aug 15 total 462.63
Aug 16 total 270.45
Aug 17 total 104.29
Today total 179.02
|
#ac -p
ynguo 193.23
yucao 3.35
rong 133.40
hdai 10.52
zjzhu 52.87
zqzhou 13.14
liangliu 24.34
total 5178.24
|
#lastlog
rong 5 202.38.64.187 Fri Aug 18 15:57:01 +0800 2000
dbb **Never logged in**
xinchen **Never logged in**
pb9511 **Never logged in**
xchen 0 202.38.64.190 Sun Aug 13 10:01:22 +0800 2000
|
# chkconfig psacct on
# /etc/init.d/psacct start
|
# lastcomm root
[root@localhost log]# lastcomm root | more
lastcomm root pts/1 0.03 secs Wed Dec 2 14:16
crond SF root __ 0.02 secs Wed Dec 2 14:15
mrtg S root __ 0.65 secs Wed Dec 2 14:15
crond SF root __ 0.01 secs Wed Dec 2 14:10
mrtg S root __ 0.65 secs Wed Dec 2 14:10
crond SF root __ 0.02 secs Wed Dec 2 14:10
sadc S root __ 0.02 secs Wed Dec 2 14:10
crond SF root __ 0.02 secs Wed Dec 2 14:05
mrtg S root __ 0.63 secs Wed Dec 2 14:05
bash F root pts/1 0.00 secs Wed Dec 2 14:02
bash F root pts/1 0.00 secs Wed Dec 2 14:01
|
# lastcomm rm
rm root pts/1 0.00 secs Wed Dec 2 14:21
rm root pts/1 0.00 secs Wed Dec 2 14:19
rm root pts/1 0.00 secs Wed Dec 2 14:19
|
# sa
207 0.41re 0.40cp 7408k mrtg
6 0.04re 0.04cp 7240k awstats.pl
15 0.01re 0.00cp 2108k ***other*
1242 53.91re 0.00cp 6081k sshd
|
6 0.04re 0.04cp 7240k awstats.p
|
# sa -u
root 0.00 cpu 595k mem accton
root 0.00 cpu 1339k mem logrotate.gf2tt
|
#Log all the mail messages in one place
mail.* /var/log/maillog
|
# Save mail and news errors of level err and higher in aspecial file.
uucp,news.crit /var/log/spooler
|
#Everybody gets emergency messages , plus log them on anther machine
*.emerg *
*.emerg @linuxaid.com.cn
|
#Root and Tiger get alert and higher messages
*.alert root,tiger
|
#Log all kernel messages to the console
#Logging much else clutters up the screen
#kern.* /dev/console
|
用户可以在一行中指明所有的设备。下面的例子把 info 或更高级别的消息送到 /var/log/messages ,除了 mail 以外。级别 "none" 禁止一个设备:
|
#Log anything ( except mail ) of level info or higher
#Don log private authentication messages!
*.info:mail.none;authpriv.none /var/log/messages
|