1. Role
The last command in a Linux system is a display of recent user or terminal logins, and its use rights are for all users. Using the last command to view the logof the program, the administrator can tell who has or attempted to connect to the system.
2. format
Last [-R] [-n][-F file][-t TTY] [-H node ] [-i-ip][-1 [-Y][id]
3. Main Parameters
-R: omit fields from hostname
-n: Specifies the number of bars for the output record.
-Ffile: Specifies the log file used as the query for the file .
-t TTY: Displays only the specified Virtual Console login status.
-H node: Displays only the login status on the specified node.
-i IP: Displays only the status of the login on the specified IP .
-1: Use IP to display the remote address.
-y: Displays the year, month, and day of the record.
-ID: Knows the user name of the query.
-x: shows the history of system shutdown, user login, and exit.
Example:
Shell>> Last-r-2
User3 PTS/1 Mon 20:42 still logged in
User3 pts/0 Mon 19:59 still logged in
Wtmp begins Tue 1 19:01:10 # # #/var/log/wtmp
Shell>> Last-2 User1
User1 pts/0 140.119.217.115 Mon 14 18:37-18:40 (00:03)
User1 pts/0 140.119.217.115 Mon 14 17:22-17:24 (00:02)
Wtmp begins Tue 1 19:01:10 2007
Usage of last command in Linux system