Wednesday, January 18, 2012

Check a log of user logins

Assumptions: You can type a command at the command prompt


Ever wanted to simply find out who logged in when and what users you have on the system?  Easy!!!

You can type:


------------------------------------------------------------------------------
lastlogin
-----------------------------------------------------------------------------

It will give you a detailed list of users and when/if they ever logged in.  Want to filter the list?  Easy!!!


------------------------------------------------------------------------------
lastlogin | grep (name of user)
-----------------------------------------------------------------------------

The command grep, as you know (or don't know) is an amazing command for filtering information displayed on a screen.  You simply pipe out the information from lastlogin into grep and grep will filter the content based on that user.  For example, if you have the user Fred, type this:


------------------------------------------------------------------------------
lastlogin | grep fred

-----------------------------------------------------------------------------

That's it.  No quotes or special characters required!

No comments:

Post a Comment