Active User List Script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Active User List Script
# 1  
Old 02-06-2017
Active User List Script

Hello guys !
I tried a script to list all the active users in the current server in AIX
Code:
who | grep '^user'

this displays the entire line ... All I need is only the user list
I found a command for linux using grep -o word
grep -o was not recognized in AIX

Can you guys help me out ?


Moderator's Comments:
Mod Comment Use code tags, thanks.

Last edited by zaxxon; 02-06-2017 at 08:03 AM..
# 2  
Old 02-06-2017
Try:
Code:
who | cut -d" " -f1

This User Gave Thanks to zaxxon For This Post:
# 3  
Old 02-06-2017
You might also look at the finger command to see if that gives useful output, such as idle time.

In your command, is ^user the literal string or does it vary on a loop? The suggestion from zaxxon could be used as input to a loop so you are not repeatedly querying.

What is your underlying need for this data and how are you using it so far? We might be able to suggest a better process.



Kind regards,
Robin
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Find number of ACTIVE SSH putty sessions, excluding where the user hopped on to a diff server

Hi - If iam logged on to server A, on 4 putty windows using SSH ... and out of these 4 logged-in sessions, in one of the sessions if i did SSH from server A to server B; i would now have 4 putty windows sessions ... of which 3 are actively logged on to Server A while 1 putty window is actively... (2 Replies)
Discussion started by: i4ismail
2 Replies

2. Solaris

Configure Solaris to accept Active Directory user logins

Is it possible to configure a Solaris server to authenticate users against an Active Directory server when logging in via ssh? I've seen some docs out there, I've followed their instructions, but it does not work. And I'm beginning to wonder if it is possible or even supported by Oracle. The... (2 Replies)
Discussion started by: BG_JrAdmin
2 Replies

3. Shell Programming and Scripting

script to ignore the user from list of users

Hi, I have a situation where I want to ignore few users from list of users and print rest of user in log file. say, I want to ignore aaa, bbb, ccc, ddd .. ppp from list of 20 user (do not want to include) What is the good command or any script? Thanks in advance. (1 Reply)
Discussion started by: sumit30
1 Replies

4. Shell Programming and Scripting

How to get list of user into an array in perl script

Hi, cut -d: -f1,3 /etc/group >rpt.out I have a doubt in perl. right i am getting list of group user id into rpt.out file. instead i need to store it as an array in perl script. could you please tell me how can i get list of user into an array in perl script.. thanks in advance. (1 Reply)
Discussion started by: solo123
1 Replies

5. Linux

Command for list of active/disabled users

Hi, I want to know the command for finding out the list of active/disabled users in Linux System. Model:x86_64. Rev:2.6.9 Thanks in advance for your help Mike (1 Reply)
Discussion started by: Mike1234
1 Replies

6. Shell Programming and Scripting

Script to AutoKill PIDs of LOGED in Active User

:confused: Hi i am trying to make a script through which i can get the total number of User and their PID after that kill all Users except the one by which i am currently logged in. (i m using SCO UNIX 5.06) # id of current usre < total number of current user USR=`who -u |wc -l` # id of... (2 Replies)
Discussion started by: aafflatoon
2 Replies

7. Shell Programming and Scripting

Online user list script

I decided to delete the first post since it was againt the forum rules (4 Replies)
Discussion started by: Necrologist
4 Replies

8. UNIX for Dummies Questions & Answers

list of active and locked OS accounts

Hello all I'm trying to generate a list of active and locked accounts at the end of every month...How would I know which account is active and which is locked or diabled ...I was looking at the /etc/passwd file but I was not sure how to differentiate between an active account and a locked... (4 Replies)
Discussion started by: luft
4 Replies
Login or Register to Ask a Question