GeekInterview.com
Series: Subject: Topic:
Question: 15 of 55

how to find how many users have logged in and logged out in last five minutes using shell scripts?

how many users have logged in and logged out in last five or 10 minutes
Asked by: hankypanky | Member Since Jul-2008 | Asked on: Jul 17th, 2008

View all questions by hankypanky

Showing Answers 1 - 9 of 9 Answers
dddbbb

Answered On : Aug 18th, 2008

View all answers by dddbbb

Track and filter the output of the last command

Yes  1 User has rated as useful.
  
Login to rate this answer.
shrigouriravi

Answered On : Sep 8th, 2008

View all answers by shrigouriravi

By Typing Who command

Yes  1 User has rated as useful.
  
Login to rate this answer.
Vijaymorey

Answered On : Apr 28th, 2009

View all answers by Vijaymorey

By writing "who -Hu" you get following details o/p

Name        Line           Time     Activity       PID Hostname

  
Login to rate this answer.

Use w command give time from when the user is logged in.
w is extended who command.

  
Login to rate this answer.

Using SIGALRM

  
Login to rate this answer.
abdas

Answered On : Jul 26th, 2011

View all answers by abdas

who -u|sort -rk4

  
Login to rate this answer.
Indu Sharma

Answered On : Jul 29th, 2011

Current_time=date +%H:%M
who -u | awk ' $4 - $Current_time == 5 {print } '

  
Login to rate this answer.
Disna

Answered On : Jan 6th, 2012

last -5|grep -i "logged in"|wc -l
last -5|grep -v "logged out"|wc -l

  
Login to rate this answer.
sonia

Answered On : Feb 19th, 2012

Current_time=`date +%H%M`
who -u | awk $Current_time - $4 <= 5 { print }

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Ads

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.