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?
last
andlastlog
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 05:06last -s ...
command seems to run fine on Centos7.lastlog
is not an equivalent oflast
, see https://unix.stackexchange.com/questions/192078/difference-between-last-and-lastlog – VPfB Apr 22 '17 at 06:04