Question
I am a new Unix system admin. How do I find ouw who has recently use the Linux or Unix-like server? Which terminals they used, and when they logged in and out of the my server?
You need to use last command. This command displays last logins of users and ttys.
Listing the Last times a user logged in on server
The syntax is as follows:
Example: Display Linux user last login
To display when a user named ‘vivek’ last logged in to the system, type:
Sample outputs:

The output in this example tell us when user vivek last logged in. The output will go back for several months or more as last command searches back through the file /var/log/wtmp and displays a list of all users logged in (and out) since that file was created.
Example: Display last reboot time
The user reboot logs in each time the system is rebooted. Thus following command will show a log of all reboots since the log file was created:
Supplement
* Linux / Unix: last Command Examples
* FAQ - How do I extract login history?
沒有留言:
張貼留言