Wednesday, February 15, 2012

Check who logged in to your Linux system

Linux (and all other unix clone OSs) have a handy way to let you know who are the users who have logged into your system. The command is "last". This command uses the file "/var/log/wtmp" and displays a list of all users logged in since the file was created.

I use it as:
last | grep -v -e bigyan -e reboot | less
Grep -v gives the complement of the results that it returns normally. The output of this command contains:
  • username of the user who logged in
  • terminal used by him/her ... pts/number
  • IP address from which logged in
  • Time of loggin in
  • Time of loggin out
  • duration logged in to the system
Read more usages of "last" command here. be sure to check out its cousin command "lastb" too.

No comments:

Post a Comment

I'd love to hear from you !