LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   List all users, command (https://www.linuxquestions.org/questions/linux-newbie-8/list-all-users-command-305419/)

amer_58 03-24-2005 05:16 AM

List all users, command
 
How can I list all the users name(shell)....

trevelluk 03-24-2005 05:33 AM

All of the users are listed in the /etc/passwd file (you may need to be root to read it). It's also got a whole load of other information as well as the user names. To just get the user names, try something like:

cat /etc/passwd | cut -d":" -f1

druuna 03-24-2005 05:34 AM

Hi,

If you mean by (shell) from the command line:

awk -F":" '{ print $1 }' /etc/passwd

Hope this helps.

amer_58 03-24-2005 06:46 AM

Thanks guys.

pk21 03-25-2005 04:32 AM

Quote:

Originally posted by trevelluk
All of the users are listed in the /etc/passwd file (you may need to be root to read it). It's also got a whole load of other information as well as the user names. To just get the user names, try something like:

cat /etc/passwd | cut -d":" -f1

All users on the system should be able to read /etc/passwd as far as I know, or else they can't log in to the system.

amer_58 03-25-2005 05:52 AM

Thats right i was able to list the all the users without root power.

trevelluk 03-25-2005 06:07 AM

Fair enough, my mistake. Need sleep.


All times are GMT -5. The time now is 09:16 PM.