LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to get list of system users from command line? (https://www.linuxquestions.org/questions/linux-general-1/how-to-get-list-of-system-users-from-command-line-156740/)

tictocdoc 03-12-2004 10:14 AM

How to get list of system users from command line?
 
Hello:

What command can I use to list the user's on a RH system from the command line??

bnice 03-12-2004 10:22 AM

`who`

tictocdoc 03-12-2004 10:38 AM

Thanks for the reply. Maybe I should have been more specific in my question. Apologies...

How can a get a list of all system users (UID #500+), including those not currently logged in?

Looking_Lost 03-12-2004 03:06 PM

Here's one simple way anyway,

Code:

#!/bin/bash
let userid=500
                                                                               
IFS="
"
for i in `cat /etc/passwd`
do
 let j=`echo $i | cut -f 3 -d ':' 2>/dev/null`
                                                                               
 if [ $j -ge $userid ]
  then
    echo $i
 fi
done

or just look in your /etc/passwd file


All times are GMT -5. The time now is 12:49 PM.