1

I used this command in ubuntu to find the last ussers logged in the past 30 minutes:

last -s -30m --fullnames |head -n -1|awk '{print $1}' | sort -u

I need the equivalent for Centos 7.

For CentOS 7 I tried:

lastlog -b 0 -t 1 | awk '{print $1}' 

But I don't know how to convert days to minutes. Is there any way to convert days to minutes in CentOS 7 with lastlog command?

  • I looked at the difference between the different versions and neither CentOS's last and lastlog have parameters that could suit your query. You would therefore need to parse the output with some scripting based on the date. – Julie Pelletier Apr 22 '17 at 5:06
  • Your last -s ... command seems to run fine on Centos7. lastlog is not an equivalent of last, see unix.stackexchange.com/questions/192078/… – VPfB Apr 22 '17 at 6:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.