lastcomm 命令

| 选择喜欢的代码风格  

lastcomm 命令语法:


lastcomm [选项]... [文件]...

lastcomm 命令选项:


-strict-match:精确匹配每一列
--user name:只显示指定用户的命令记录。
--command name:只显示指定命令的记录。
--tty name:只显示在指定终端上运行的命令。
-f filename:指定一个命令记录文件来代替默认文件——acct。
--debug:打印其他内核信息。
-V,--version:打印版本。
-h,--help:打印概要和系统默认统计文件(Linux里面的默认文件多是/var/log/pacct 和/var/account/pacct)。

lastcomm 命令实例:



[root@redis-01 /home/yongyu]
# lastcomm ls
ls                     root     pts/1      0.00 secs Tue Mar 26 11:57
ls                     root     pts/1      0.00 secs Tue Mar 26 11:56
ls                     root     pts/1      0.00 secs Tue Mar 26 11:56
ls                     root     pts/1      0.00 secs Tue Mar 26 11:55
ls                     root     pts/1      0.00 secs Tue Mar 26 11:55
ls                     root     pts/1      0.00 secs Tue Mar 26 11:54
ls                     root     pts/1      0.00 secs Tue Mar 26 11:53
ls                     root     pts/1      0.00 secs Tue Mar 26 11:53
ls                     root     pts/1      0.00 secs Tue Mar 26 11:53
ls                     root     pts/1      0.00 secs Tue Mar 26 11:51
ls                     root     pts/1      0.00 secs Tue Mar 26 11:51
ls                     root     pts/1      0.00 secs Tue Mar 26 11:51
ls                     root     pts/1      0.00 secs Tue Mar 26 11:49

# lastcomm yongyu
sa                     yongyu   pts/2      0.00 secs Tue Mar 26 11:59
bash              F    yongyu   pts/2      0.00 secs Tue Mar 26 11:59
id                     yongyu   pts/2      0.00 secs Tue Mar 26 11:59
bash              F    yongyu   pts/2      0.00 secs Tue Mar 26 11:59
consoletype            yongyu   pts/2      0.00 secs Tue Mar 26 11:59
grep                   yongyu   pts/2      0.00 secs Tue Mar 26 11:59
bash              F    yongyu   pts/2      0.00 secs Tue Mar 26 11:59
dircolors              yongyu   pts/2      0.00 secs Tue Mar 26 11:59
bash              F    yongyu   pts/2      0.00 secs Tue Mar 26 11:59
tput                   yongyu   pts/2      0.00 secs Tue Mar 26 11:59
tty                    yongyu   pts/2      0.00 secs Tue Mar 26 11:59
grepconf.sh            yongyu   pts/2      0.00 secs Tue Mar 26 11:59

# lastcomm | grep "Mar 26 12:0[2]"  
UpgradePlugin    S   X root     __         0.00 secs Tue Mar 26 12:02
MonitorPlugin    S   X root     __         0.00 secs Tue Mar 26 12:02
getconf                root     __         0.00 secs Tue Mar 26 12:02
getconf                root     __         0.00 secs Tue Mar 26 12:02
bash             S     root     __         0.00 secs Tue Mar 26 12:02
bash              F    root     __         0.00 secs Tue Mar 26 12:02
bash              F    root     __         0.00 secs Tue Mar 26 12:02
dirname                root     __         0.00 secs Tue Mar 26 12:02
sh                     root     __         0.00 secs Tue Mar 26 12:02
awk                    root     __         0.00 secs Tue Mar 26 12:02
grep                   root     __         0.00 secs Tue Mar 26 12:02
sh                     root     __         0.00 secs Tue Mar 26 12:02
awk                    root     __         0.00 secs Tue Mar 26 12:02
grep                   root     __         0.00 secs Tue Mar 26 12:02
cat                    root     __         0.00 secs Tue Mar 26 12:02
cat                    root     __         0.00 secs Tue Mar 26 12:02


发表评论