Find who logged in system apart from myself


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Find who logged in system apart from myself
# 1  
Old 07-04-2011
Find who logged in system apart from myself

Hi,

I need to find the users logged in the system beside me.
as

Code:
uname -u

gives all the user and

Code:
uname -um

gives the current user on system.

How can i get result of
Code:
uname -u

minus
Code:
uname -um

.

I want to do it in one line.

tried with grep but not successful.
# 2  
Old 07-04-2011
Use who and id to stay portable:
Code:
who | grep -v "^$( id -un )"

# 3  
Old 07-04-2011
Thanks pludi.

but the problem is :

like the user "root" is being used by many users to login and i want to find that apart from me(current user ) who else have logged in with root.So just excluding the name of user doesn't help Smilie.
# 4  
Old 07-04-2011
If possible post sample output of uname -u and uname -um and the machine your working.
# 5  
Old 07-04-2011
Here is the output i get:

Code:
who -u
kailash  pts/0        2011-07-04 10:41   .          8336 (172.31.169.1)
kailash  pts/1        2011-07-04 10:41 03:13        8442 (172.31.169.1)
kailash  pts/3        2011-07-04 15:20 00:48       11094 (172.31.169.1)
kailash  pts/4        2011-07-04 15:20 01:35       11197 (172.31.169.1)
kailash  pts/5        2011-06-28 11:30 04:18       13030 (172.31.168.146)

Code:
kailash  pts/0        2011-07-04 10:41   .          8336 (172.31.169.1)


Its a sample output.
# 6  
Old 07-05-2011
Can we grep out the . and try..?
Code:
# Machine - GNU Linux's output
who -a | grep -v " \. "
who -a | awk '$6!="."{print}'

This User Gave Thanks to michaelrozar17 For This Post:
# 7  
Old 07-05-2011
Thanks Michael.

It works Smilie Smilie.

but for :
Code:
who -a | awk '$6!="."{print}'

it should be :
Code:
who -a | awk '$5!="."{print}'

Also i have thought of this one:
Code:
WHO=`who -um`;who -u | grep -v "$WHO"

 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Users logged into the system

So I'm trying to write a single line command So I have to use last first in this command and I've figured out the format my professor wants it in, something like thislast | cut -d' ' -f1,15 | sort > check | uniq -c.... and I never can get it right, when I just last command I get something... (2 Replies)
Discussion started by: DoubleAlpha
2 Replies

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

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

6. Shell Programming and Scripting

Bash Help: users who are not logged into the system to display

A Newbie here, I am working on a script and am having problems with the else part of the script. I can't get the users who are not logged into the system to display on the screen with their username and the text "The user is not logged in". I am sure it is something simple and stupid, but I... (5 Replies)
Discussion started by: rchirico
5 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. Shell Programming and Scripting

find station from where is logged in

for secure access purposes I want to know where somebody logs in working in K shell I have who am i= giving user and terminal =gxb pts/4 Jan 22 15:0 finger user => gives all sessions of user = Login name: gxb Directory: /home/gxb ... (17 Replies)
Discussion started by: ghislain
17 Replies
Login or Register to Ask a Question