LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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, 10: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, 11:33 AM   #2
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 281Reputation: 281Reputation: 281
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, 11:40 AM   #3
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,499
Blog Entries: 2

Rep: Reputation: 68
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



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 01:15 PM
list of users Ab3n Linux - Newbie 3 03-08-2006 12:30 PM
list out the users. bruse Linux - Newbie 2 07-19-2005 08:46 AM
List all users eam Linux - Newbie 7 05-15-2005 11:55 PM
[Samba] how to list users yan1 Linux - Networking 2 04-04-2005 07:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:55 AM.

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
Open Source Consulting | Domain Registration