Shell script to display user logged last week and time connected


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell script to display user logged last week and time connected
# 1  
Old 10-29-2010
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
# 2  
Old 10-29-2010
Code:
man who

# 3  
Old 10-29-2010
Thanks ctsgnb, I had read the options of who. But I didn't find anything where I can put a period of time.
# 4  
Old 10-29-2010
who shows who is logged in (now).

last shows both who is logged in now, and who was logged in previously, as well as how long they were logged in for. The output requires some parsing to get to the information you are looking for.

On AIX, I'd use fwtmp (to read the wtmp file that holds this information) to make this easier. There should be a similar command for other OS's.
# 5  
Old 10-29-2010
Code:
man last

Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to Display Day of the Week/and all the years?

I'm not sure exactly how to display the day of the week when a particular date is entered. For example, if April 12 2016 is entered then the result should be Tuesday. Or if June 17 2015 is entered then the result should be Wednesday. I know you can use $ date -d "1974-01-04" +"%A" but I... (1 Reply)
Discussion started by: bud1738
1 Replies

2. 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

3. Shell Programming and Scripting

Need help on shell script to monitor each user cpu use on a cluster over time

Hi, I am relatively new to the cluster administration and shell scripting. I need help on a shell script which can help me determine how many cpu's over time, any particular ( or all registered users on a cluster ) are using. To generate data say over a period of week and list of users and their... (6 Replies)
Discussion started by: anuj06
6 Replies

4. Shell Programming and Scripting

HOW: Shell script accessing files located in individual logged in user.

Hi I have below scenario, I hope this could be possible, but as of now no idea how to implement this. Mount point in this location /abc/mp, and there will different users who will be executing one the file shell1.sh file located in /abs/mp, but every user will execute this shell1.sh file from... (1 Reply)
Discussion started by: shekharjchandra
1 Replies

5. Homework & Coursework Questions

shell to check user is logged on

I was given this to do, Write a Shell script to automatically check that a specified user is logged in to the computer. The program should allow the person running the script to specify the name of the user to be checked, the frequency in seconds at which the script should check. If a... (0 Replies)
Discussion started by: operator
0 Replies

6. 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

7. 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

8. 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

9. Shell Programming and Scripting

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... (4 Replies)
Discussion started by: salman4u
4 Replies

10. Shell Programming and Scripting

script on user who logged in????

writing a script that will check every 5 seconds whether a particular user has logged into the system # Determine if someone is logged on # Version 4.0 if then echo “ Incorrect number of arguments” echo “Usage: $ ison4 <user>” else user=“$1” if who | grep “$user” > /dev/null then... (2 Replies)
Discussion started by: kim187
2 Replies
Login or Register to Ask a Question