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 03-24-2005, 05:16 AM   #1
amer_58
Member
 
Registered: Mar 2004
Distribution: Slackware 10.2
Posts: 213

Rep: Reputation: 30
List all users, command


How can I list all the users name(shell)....
 
Old 03-24-2005, 05:33 AM   #2
trevelluk
Member
 
Registered: Nov 2003
Location: Bristol, UK
Distribution: Debian Lenny, Gentoo (at work)
Posts: 388

Rep: Reputation: 32
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
 
Old 03-24-2005, 05:34 AM   #3
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

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

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

Hope this helps.
 
Old 03-24-2005, 06:46 AM   #4
amer_58
Member
 
Registered: Mar 2004
Distribution: Slackware 10.2
Posts: 213

Original Poster
Rep: Reputation: 30
Thanks guys.
 
Old 03-25-2005, 04:32 AM   #5
pk21
Member
 
Registered: Jun 2002
Location: Netherlands - Amsterdam
Distribution: RedHat 9
Posts: 549

Rep: Reputation: 30
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.
 
Old 03-25-2005, 05:52 AM   #6
amer_58
Member
 
Registered: Mar 2004
Distribution: Slackware 10.2
Posts: 213

Original Poster
Rep: Reputation: 30
Thats right i was able to list the all the users without root power.
 
Old 03-25-2005, 06:07 AM   #7
trevelluk
Member
 
Registered: Nov 2003
Location: Bristol, UK
Distribution: Debian Lenny, Gentoo (at work)
Posts: 388

Rep: Reputation: 32
Fair enough, my mistake. Need sleep.
 
  


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
What is the command to list users? neo_in_matrix Linux - Newbie 27 11-29-2017 06:09 AM
Is there a single command to list all hardware installed (command line)? davee Linux - Hardware 6 02-28-2009 07:19 PM
Command to run another command against a list of files psweetma Linux - General 3 11-09-2005 05:29 PM
command to list all users of the system?? simi_544 Linux - Networking 9 09-29-2005 03:00 AM
How to get list of system users from command line? tictocdoc Linux - General 3 03-12-2004 03:06 PM

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

All times are GMT -5. The time now is 08:09 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