天天看点

查看用户登录命令last

查看有哪些用户登录服务器:

[test@nginx03 ~]$ last -n 5

vc       pts/5        58.63.5.251      Tue Mar  8 09:27   still logged in   

vc       pts/4        121.8.154.218    Tue Mar  8 09:05   still logged in   

vc       pts/3        121.8.154.218    Tue Mar  8 09:02   still logged in   

tyyw03   pts/3        10.153.1.61      Tue Mar  8 08:23 - 08:23  (00:00)    

tyyw03   pts/3        10.153.1.61      Tue Mar  8 08:22 - 08:23  (00:00)    

~

要只看前5个,需要用awk过滤一下:

[test@nginx03 ~]$ last -n 5|awk '{print $1}'  

vc

tyyw03

继续阅读