-n <显示行数>或-<显示行数> 设置显示多少行记录
-w
Display full user and domain names in the output
-R
不显示登入系统的主机名称或IP(省略 hostname 的栏位)
-t
显示YYYYMMDDHHMMSS之前的信息
-x
显示系统关闭、用户登录和退出的历史
使用示例:
1:查看last命令的帮助信息
| [root@DB-Server ~]# man last [root@DB-Server ~]# last -h last: invalid option -- h Usage: last [-num | -n num] [-f file] [-t YYYYMMDDHHMMSS] [-R] [-x] [-o] [-w] [username..] [tty..] |
2:显示最后登录系统的N条记录
| [root@DB-Server ~]#last -10 root pts/1 :0.0 Wed Dec 18 09:54 still logged in root pts/4 :0.0 Wed Dec 18 09:43 - 09:48 (00:04) root pts/1 :0.0 Wed Dec 18 09:43 - 09:48 (00:05) root pts/3 192.168.103.79 Wed Dec 18 09:41 - 12:40 (02:59) root pts/4 :0.0 Wed Dec 18 09:28 - 09:30 (00:01) root pts/3 :0.0 Wed Dec 18 09:27 - 09:30 (00:02) root pts/2 192.168.103.29 Wed Dec 18 09:27 still logged in root pts/1 :0.0 Wed Dec 18 09:27 - 09:42 (00:15) root pts/2 :0.0 Wed Dec 18 09:23 - 09:25 (00:01) root pts/1 :0.0 Wed Dec 18 09:22 - 09:25 (00:02) wtmp begins Wed Dec 11 03:02:17 2013 [root@DB-Server ~]# last -n 10 root pts/1 :0.0 Wed Dec 18 09:54 still logged in root pts/4 :0.0 Wed Dec 18 09:43 - 09:48 (00:04) root pts/1 :0.0 Wed Dec 18 09:43 - 09:48 (00:05) root pts/3 192.168.103.79 Wed Dec 18 09:41 - 12:40 (02:59) root pts/4 :0.0 Wed Dec 18 09:28 - 09:30 (00:01) root pts/3 :0.0 Wed Dec 18 09:27 - 09:30 (00:02) root pts/2 192.168.103.29 Wed Dec 18 09:27 still logged in root pts/1 :0.0 Wed Dec 18 09:27 - 09:42 (00:15) root pts/2 :0.0 Wed Dec 18 09:23 - 09:25 (00:01) root pts/1 :0.0 Wed Dec 18 09:22 - 09:25 (00:02) wtmp begins Wed Dec 11 03:02:17 2013 |
3:将登录系统的主机名或IP地址显示在最后一行








