find station from where is logged in


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting find station from where is logged in
# 8  
Old 01-23-2007
Try this:
Code:
$finger -m username | grep "On since" | awk '{print $NF}'

# 9  
Old 01-23-2007
It would work if in place of the "On Since" I could put the terminal as a result from who am i = who am i |cut -c12-20
# 10  
Old 01-23-2007
Quote:
Originally Posted by ghislain
It would work if in place of the "On Since" I could put the terminal as a result from who am i = who am i |cut -c12-20
It would be better idea to put here exactly what you are looking for rather telling us how you want to acheive it, because you mentioned earlier that you are looking for to get the station name from where user is initiating the connection and I think the command which I have given you suffice your requiremnt, can you please post here your exact requirements.

Thanks.
# 11  
Old 01-23-2007
I try to be more clear:
below is the output of finger gxb

$ finger gxb
Login name: gxb
Directory: /home/gxb Shell: /sbin/ksh
On since Jan 22 15:05:31 on pts/4 from BS-013
1 hour 13 minutes Idle Time
No unread mail
No Plan.

Login name: gxb
Directory: /home/gxb Shell: /sbin/ksh
On since Jan 23 10:58:52 on pts/10 from BS-013
11 minutes Idle Time

Login name: gxb
Directory: /home/gxb Shell: /sbin/ksh
On since Jan 23 11:03:02 on pts/11 from BS-013
23 minutes Idle Time

Login name: gxb
Directory: /home/gxb Shell: /sbin/ksh
On since Jan 23 11:26:14 on pts/12 from BS-014
18 seconds Idle Time

as you can see I connect several sessions ( pts/4 pts/10 pts/11 pts/12) from several locations BS-013 BS-014

I only want to know on what location I logged on
# 12  
Old 01-23-2007
Ok, try:
Code:
finger gxb|awk ' /from/ {print $NF}'|sort -u

bye
# 13  
Old 01-23-2007
Code:
finger gxb | \
awk '$1=="On" && $(NF-1)=="from" { print $NF }' |\
sort | uniq -c


Jean-Pierre.
# 14  
Old 01-23-2007
Hello

thanks, this gives me the 2 locations.

However I only want the one I am actually working on
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 find users not logged in for 90 days

Dear All, I need your help in finding out users not logged in to linux system for more than 90 days. I found a script from our forum i am getting error while using that. from the code i have debugged line by line to see where i am getting the problem. i found out the below line i am getting... (5 Replies)
Discussion started by: Sachinlinux
5 Replies

2. UNIX for Dummies Questions & Answers

Find who logged in system apart from myself

Hi, I need to find the users logged in the system beside me. as uname -u gives all the user and uname -um gives the current user on system. How can i get result of uname -u minus uname -um . I want to do it in one line. tried with grep but not successful. (6 Replies)
Discussion started by: kailash19
6 Replies

3. UNIX for Dummies Questions & Answers

how to find top 3 users currently logged on

For the first 3 users only that are currently logged in output their effective user id. thank you. (6 Replies)
Discussion started by: whyatepies
6 Replies

4. Shell Programming and Scripting

find top 4 users currently logged on can i use grep

For the first 4 users only that are currently logged in output their effective user id. It's not important the order in which each logged in i just want to have the top 4. Same question as here...... (0 Replies)
Discussion started by: whyatepies
0 Replies

5. Shell Programming and Scripting

Script to find systems logged in with a particular userid

Hello All, I need to design a script to get all the systems names(IP Addresses) logged in with a particular userid say 'xyz' from different terminals. This is to track the use of the particular userid and take action if it is being misused. The script would accomplish the following steps: 1.... (1 Reply)
Discussion started by: mehimadri
1 Replies

6. Ubuntu

How can we find out who are all logged out recently?

Hi, I need to find out who are all the users logged out recently or some minutes or some hours ago. :b: (4 Replies)
Discussion started by: balan_mca
4 Replies

7. Solaris

how to find who logged in

Hi, How do I find who logged in last 30 days? I have last command command, but is there any option to find only last 30 days? Thanks in advance. (0 Replies)
Discussion started by: mokkan
0 Replies

8. Shell Programming and Scripting

to find the number of users logged in

Hi, can u say to display the number of users that logged before me. thanks (10 Replies)
Discussion started by: shanshine
10 Replies

9. UNIX for Dummies Questions & Answers

know who logged and logged out with their timings

being ordinary user (not having any administrative rights) can avail myself a facility to know who logged and logged out with their timings get popped onto my terminal as if it get echo 'ed... (3 Replies)
Discussion started by: vkandati
3 Replies

10. UNIX for Dummies Questions & Answers

18Gb HD with Sparc Station 5 ?

Hello all, A quick question on Sparc Station 5. Can I use 18GB hard disk with Sparc Station 5 ?. I searched sunsolve documentation. It gives info only upto 4.2 GB for sparcstaton 5. The OS is SunOS 5.5.1 Thank You, (3 Replies)
Discussion started by: shibz
3 Replies
Login or Register to Ask a Question