LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 02-08-2005, 08:09 AM   #1
racer_mec
LQ Newbie
 
Registered: Dec 2004
Posts: 11

Rep: Reputation: 0
shell script to calculate the time a user is logged in


hello ,
i am trying to write a shellscript which will provide the name ,logged in time , logout time and total time for all the users accessing a particular machine..how do i do this...with the last command i got many details..can i extract te needed values from the output of this command..please help..
thanks in advancehttp://www.linuxquestions.org/questions/newthread.php?s=&action=newthread&forumid=8#
 
Old 02-08-2005, 08:55 AM   #2
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 53
'who' will tell you who is logged in and what time they logged in. Not sure about logout time though. You could use last and pipe the output through awk which will let you extract the fields using $1 $2 $3 etc for each field.
 
Old 02-08-2005, 11:40 AM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,966
Blog Entries: 11

Rep: Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865
Have a look at the output of
last

Depending on how (whether) you shut down the
box it will provide reasonably accurate time info
for users ...


Cheers,
Tink
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Control amount of time a user may be logged in. (Parental Control) darrensnospam Mandriva 13 02-18-2006 05:01 PM
Calculate in shell script Ephracis Linux - General 1 12-16-2004 11:11 AM
strange request: script to track logged in time hamster Linux - General 3 05-08-2003 12:52 PM
mozilla works fine when logged in as a user but crashes when logged in as root jimi Linux - General 6 04-02-2003 08:34 PM
Remote message: User: already logged onto system 1 time(s). jamaso Linux - General 1 11-08-2002 05:08 AM


All times are GMT -5. The time now is 07:32 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration