HostOnNet Blog

Last logged in users

last is a command used to list last logged in users on a linux system.

[root@m3722 ~]# last
root     pts/0        112.133.248.3    Wed Jul 19 21:55   still logged in   
root     pts/0        112.133.248.3    Tue Jul 18 19:58 - 20:00  (00:01)    
root     pts/0        194.65.5.232     Tue Jul 18 10:47 - 10:54  (00:06)    
root     pts/2        bl13-193-176.dsl Tue Jul 18 03:37 - 03:54  (00:16)    
root     pts/2        bl13-193-176.dsl Tue Jul 18 03:33 - 03:36  (00:02)    
root     pts/0        bl13-193-176.dsl Tue Jul 18 02:54 - 10:47  (07:53)    
reboot   system boot  3.10.0-514.21.1. Mon Jun 19 19:46 - 21:56 (30+02:10)  
root     pts/0        m2545.contabo.ho Mon Jun 19 16:59 - 16:59  (00:00)    
root     pts/0        m2545.contabo.ho Sat Jun 17 16:23 - 16:23  (00:00)    
root     pts/0        m2545.contabo.ho Sat Jun 17 16:23 - 16:23  (00:00)    
reboot   system boot  3.10.0-514.el7.x Sat Jun 17 15:51 - 17:44 (2+01:52)   

wtmp begins Sat Jun 17 15:51:55 2017
[root@m3722 ~]# 

Show Full Hostname in last

To see full host name in last result, use -w option

[root@m3722 ~]# last -w
root     pts/0        112.133.248.3    Thu Jul 20 06:10   still logged in   
root     pts/0        112.133.248.3    Wed Jul 19 21:55 - 23:07  (01:11)    
root     pts/0        112.133.248.3    Tue Jul 18 19:58 - 20:00  (00:01)    
root     pts/0        194.65.5.232     Tue Jul 18 10:47 - 10:54  (00:06)    
root     pts/2        bl13-193-176.dsl.telepac.pt Tue Jul 18 03:37 - 03:54  (00:16)    
root     pts/2        bl13-193-176.dsl.telepac.pt Tue Jul 18 03:33 - 03:36  (00:02)    
root     pts/0        bl13-193-176.dsl.telepac.pt Tue Jul 18 02:54 - 10:47  (07:53)    
reboot   system boot  3.10.0-514.21.1.el7.x86_64 Mon Jun 19 19:46 - 06:12 (30+10:26)  
root     pts/0        m2545.contabo.host Mon Jun 19 16:59 - 16:59  (00:00)    
root     pts/0        m2545.contabo.host Sat Jun 17 16:23 - 16:23  (00:00)    
root     pts/0        m2545.contabo.host Sat Jun 17 16:23 - 16:23  (00:00)    
reboot   system boot  3.10.0-514.el7.x86_64 Sat Jun 17 15:51 - 17:44 (2+01:52)   

wtmp begins Sat Jun 17 15:51:55 2017
[root@m3722 ~]# 

Posted in Linux