Active User List Script

Hello guys !
I tried a script to list all the active users in the current server in AIX

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 ?

Try:

who | cut -d" " -f1
1 Like

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