How can one know how much time user logged?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How can one know how much time user logged?
# 1  
Old 03-01-2009
How can one know how much time user logged?

Hello,
i know who command gives you the time when particular user logged in. And subtracting today's date and time from the one found in who we can get how much time user logged in. But this can get very much clumsy as we can't subtract date directly in unix . Is there any other way or command through which we can get this info?
Thanks in advance Smilie
# 2  
Old 03-01-2009
Have a look at 'last'
# 3  
Old 03-02-2009
last also doesn't give directly the total time user logged in? it gives just starting and ending time, and i cant subtract date directly like loggedOutTime - loggedInTime. Unix doesn't permit me this. Any other options?
# 4  
Old 03-02-2009
Could you please see below output from LAST comman from my pc

batch ftp o2hp91.uk.pri.o2 Mon Jun 30 12:43 - 12:43 (00:00)
batch pts/4 asst206613.uk.pr Mon Jun 30 12:40 - 09:40 (20:59)
batch pts/3 dasst102938.uk.p Mon Jun 30 11:38 - 10:23 (22:44)
oracle pts/3 lasst205223.uk.p Mon Jun 30 09:06 - 09:10 (00:03)
batch pts/3 asst206613.uk.pr Tue Jun 24 09:26 - 13:42 (1+04:16)
oracle pts/3 lasst205223.uk.p Mon Jun 23 14:19 - 16:06 (01:47)

Already, it's gived calculated time

Please let me know.

Regards,
Divyang
# 5  
Old 03-02-2009
ya you are right divyang. Actually i had to run this command from college to get a better idea. You are right it gives calculated time.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

• Write a shell script that upon invocation shows the time and date and lists all the logged-in user

help me (1 Reply)
Discussion started by: sonu pandey
1 Replies

2. Red Hat

How to confirm an user logged in is a remote user?

How do I confirm if a user logged in, is remote or local? In the case if the user is remote, how to be sure what authentication/method is it using, like LDAP, NIS or other? (2 Replies)
Discussion started by: kirtikjr
2 Replies

3. Shell Programming and Scripting

Does running a cron job of a user require the user to be logged in?

Suppose user 'asdf' is not logged into server 'bbbb', but the server is up. User 'asdf' has cron job. Will it be executed? (1 Reply)
Discussion started by: thulasidharan2k
1 Replies

4. UNIX for Dummies Questions & Answers

Script to determine logged in time

Hi all So I am thinking my inability to cope with math is bogging me down here so Im asking for help. I want to determine how long a user has been logged on for by using the date and who commands to determine the time they have been logge don. My problem is that I keep getting the wrong... (2 Replies)
Discussion started by: losingit
2 Replies

5. Shell Programming and Scripting

Shell script to display user logged last week and time connected

Hello all, I want to display all the user logged last week and know the time tnat they are connected. I have been looking for a solution in the Forum, but I didn't find. Thanks in advance (4 Replies)
Discussion started by: ahernandez
4 Replies

6. UNIX Desktop Questions & Answers

Shell script to display user logged in within given time

how can i know which users have logged in at specified given start and end time in 24 hour format? (3 Replies)
Discussion started by: meherzad4u
3 Replies

7. UNIX for Dummies Questions & Answers

How many time have user logged last X days?

Hi all.. I was trying to do a little shell script, that would list users and their login times, lets say like last 5 days. But I couldnt figure out how to count users login times from previous days. Any tips? Funny that nobody has do this kinda script before, or atleast I couldnt find on... (2 Replies)
Discussion started by: Kimmo_
2 Replies

8. UNIX for Advanced & Expert Users

Send email as a different user than the user logged in

Hi I am using mailx to send email and am wondering if there is a way I can send the email from a different user than the user logged in. something like do-not-reply@xyz.com Thank you. (1 Reply)
Discussion started by: rakeshou
1 Replies

9. Shell Programming and Scripting

Last time logged in

Working in AIX (so no date -d) How can i display all the users who have not logged in for more than 40 days? A small quick script would be usefull, my scripts are always taking to long to execute, even before they are finished. Many thanks! (5 Replies)
Discussion started by: ughosting
5 Replies

10. UNIX for Dummies Questions & Answers

Finding last time users logged in

I would like to find out the last time all users have logged in or out. I tried the last command, but it could not find the wtmp file in /var/adm (I searched in othe directories also). This is an AIX rs6000 4.2.1 system. We are moving our applications from this system to an AIX 5.2 system and I... (11 Replies)
Discussion started by: jyoung
11 Replies
Login or Register to Ask a Question