日期:2014-05-16  浏览次数:20543 次

我使用过的Linux命令之ac - 在线时间统计

我使用过的Linux命令之ac - 在线时间统计

本文链接:http://codingstandards.iteye.com/blog/774457 ? (转载请注明出处)

用途说明

打印用户连接的时间 Prints statistics about users' connect time.

ac命令根据当前的/var/log/wtmp文件中的登录进入和退出来报告用户连接的时间(小时),如果不使用标志,则报告总的时间【2】。也就是统计用户的在线时间。

常用参数

-d 按每天的统计数据打印。 Print totals for each day rather than just one big total at the end.

-y 在显示日期的时候输出年份。 Print year when displaying dates.

-p 打印每个账号的总的连接时间。 Print time totals for each user in addition to the usual everything-lumped-into-one value.

使用示例

示例一

[root@web ~]# ac
??????? total???? 1366.71

[root@web ~]# ac -d -y
Jun 28 2010???? total??????? 5.48
Jun 29 2010???? total?????? 15.97
Jun 30 2010???? total?????? 25.38
Jul? 1 2010???? total?????? 33.62
Jul? 3 2010???? total?????? 14.17
Jul? 4 2010???? total?????? 24.94
Jul? 5 2010???? total??????? 4.35
Jul? 6 2010???? total?????? 46.59
Jul? 7 2010???? total?????? 67.27
Jul? 8 2010???? total?????? 41.07
Jul? 9 2010???? total?????? 81.77
Jul 10 2010???? total?????? 45.72
Jul 12 2010???? total?????? 35.99
Jul 13 2010???? total?????? 52.14
Jul 14 2010???? total?????? 50.01
Jul 15 2010???? total?????? 37.90
Jul 16 2010???? total?????? 39.18
Jul 17 2010???? total??????? 6.59
Jul 18 2010???? total??????? 8.08
Jul 19 2010???? total?????? 10.93
Jul 20 2010???? total??????? 5.56
Jul 21 2010???? total?????? 11.23
Jul 23 2010???? total??????? 1.49
Aug? 1 2010???? total??????? 6.91
Aug? 9 2010???? total??????? 9.36
Aug 10 2010???? total?????? 34.48
Aug 11 2010???? total?????? 24.88
Aug 12 2010???? total?????? 24.21
Aug 13 2010???? total?????? 38.00
Aug 14 2010???? total??????? 9.05
Aug 19 2010???? total?????? 26.42
Aug 20 2010???? total?????? 62.44
Aug 21 2010???? total??????? 9.58
Aug 23 2010???? total?????? 22.59
Aug 25 2010???? total??????? 0.17
Aug 27 2010???? total??????? 4.56
Aug 30 2010???? total??????? 1.03
Aug 31 2010???? total??????? 9.67
Sep? 1 2010???? total??????? 1.51
Sep? 2 2010???? total??????? 4.82
Sep? 5 2010???? total??????? 3.71
Sep? 6 2010???? total??????? 0.38
Sep? 7 2010???? total?????? 44.68
Sep? 8 2010???? total??????? 0.65
Sep? 9 2010???? total?????? 31.65
Sep 10 2010???? total?????? 31.27
Sep 11 2010???? total??????? 0.41
Sep 12 2010???? total??????? 9.70
Sep 13 2010???? total?????? 14.57
Sep 14 2010???? total?????? 27.97
Sep 15 2010???? total?????? 13.19
Sep 16 2010???? total?????? 14.82
Sep 17 2010???? total?????? 14.37
Sep 18 2010???? total?????? 16.20
Sep 19 2010???? total?????? 30.74
Sep 20 2010???? total?????? 27.55
Sep 21 2010???? total?????? 27.44
Sep 24 2010???? total??????? 3.46
Sep 25 2010???? total?????? 21.43
Sep 26 2010???? total?????? 19.55
Sep 27 2010???? total?????? 14.24
Today?????????? total?????? 44.09

示例二

[root@web186 hycu2]# ac
??????? total?????? 37.42

[root@web186 hycu2]# ac -d -y
Sep? 1 2010???? total??????? 3.77
Sep? 9 2010???? total??????? 6.70
Sep 13 2010???? total??????? 8.56
Sep 14 2010???? total??????? 4.75
Sep 15 2010???? total?????? 11.15
Sep 20 2010???? total??????? 2.19
Today?????????? total??????? 0.35

示例三

[web@hnweb1 ~]$