LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 05-02-2006, 11:58 AM   #1
binary_0011
Member
 
Registered: Apr 2006
Location: Singapore
Distribution: RHEL4,FC4,FC5
Posts: 89

Rep: Reputation: 15
how to list all users in shell?


i can do a system-config-users but this will open a gui.

any other command?

thanks.
 
Old 05-02-2006, 12:33 PM   #2
pljvaldez
Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Squeeze (x86)
Posts: 6,092

Rep: Reputation: 269Reputation: 269Reputation: 269
ls /home or awk -F: '{ print $1 }' /etc/passwd

Or if you want to only get usernames that are actual users (i.e. leave out system made users like nobody, root, ftp, etc), try this:
Code:
awk -F: '$3 >= 1000 && $3 < 10000 { print $3 " " $1 }' /etc/passwd
Note that you'll probably have to modify the number range. In my system, UID's start at 1000 for normal users. $1 corresponds to the column of /etc/passwd containing usernames, $3 is the UID column. Once you figure out the range you need, you can remove the $3 " " section of the print statement.
 
Old 05-02-2006, 12:40 PM   #3
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,393
Blog Entries: 1

Rep: Reputation: 64
Code:
# awk -F: '{if (($3>=500)&&($3<=60000)) print $1}' /etc/passwd
500 is the minimum UID in your system.
60000 is the maximum UID. Check the MINUID and MAXUID for your system at /etc/login.defs.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
List of users nickyboy Linux - Newbie 1 04-20-2006 02:15 PM
list of users Ab3n Linux - Newbie 3 03-08-2006 01:30 PM
list out the users. bruse Linux - Newbie 2 07-19-2005 09:46 AM
List all users eam Linux - Newbie 7 05-16-2005 12:55 AM
[Samba] how to list users yan1 Linux - Networking 2 04-04-2005 08:23 AM


All times are GMT -5. The time now is 10:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration