Let’s say you want to see who was logged in on the server during last weekend. This includes users who, say, logged in on Thursday and haven’t logged out until Saturday afternoon.

The newer version of the last command includes two options: -s (starting time) and -t (ending time). This makes our task simple:

The older versions of last only have the -t option, which makes things a bit more interesting. You can try to update the package that provides last. Here’s an example using yum:

However, this is not likely to get you the desired version of the sysvinit-tools package. The solution is to run last twice for two overlapping time intervals and use diff to extract the desired time window:

 

Leave A Reply

Please enter your comment!
Please enter your name here