Latest web development tutorials

Linux last Command

Linux command Daquan Linux command Daquan

Linux last command is used to display system since start from the beginning of each month is eligible for a sign's message.

Access: All users.

grammar

shell>> last [options]

Parameter Description:

  • -R Omitted hostname field
  • Display num months ago -num
  • Sign posts show username username of
  • tty limit sign message includes the terminal code

Examples

shell>> last -R -2
johnney pts/1 Mon Aug 14 20:42 still logged in
johnney pts/0 Mon Aug 14 19:59 still logged in
wtmp begins Tue Aug 1 09:01:10 2000 ### /var/log/wtmp
shell>> last -2 minery
minery pts/0 140.119.217.115 Mon Aug 14 18:37 - 18:40 (00:03)
minery pts/0 140.119.217.115 Mon Aug 14 17:22 - 17:24 (00:02)
wtmp begins Tue Aug 1 09:01:10 2000

General display method

# last

Brief display, and specify the number of display

# last -n 5 -R
root   pts/4    Thu May 13 17:25  still logged in  
root   pts/2    Thu May 13 17:23 - 17:25 (00:02)  
root   pts/1    Thu May 13 16:46  still logged in  
root   pts/7    Thu May 13 15:36  still logged in  
root   pts/9    Thu May 13 15:35  still logged in  

wtmp begins Thu May 13 18:55:40 2014

Displays the last column shows the IP address of the host

# last -n 5 -a -i
root   pts/4    Thu May 13 17:25  still logged in  192.168.1.10
root   pts/2    Thu May 13 17:23 - 17:25 (00:02)   192.168.1.10
root   pts/1    Thu May 13 16:46  still logged in  192.168.1.10
root   pts/7    Thu May 13 15:36  still logged in  192.168.1.10
root   pts/9    Thu May 13 15:35  still logged in  192.168.1.10

wtmp begins Thu May 13 18:55:40 2014

Linux command Daquan Linux command Daquan