LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 07-05-2006, 02:31 PM   #1
sniff
Member
 
Registered: Jan 2003
Location: Durham UK
Distribution: openSUSE 12.2/3 x86_64, Debian
Posts: 307

Rep: Reputation: 42
Question List of All user accounts from command line


Hello,
Is there a way of listing all the users of a system from the command line? I cannot find anything that will list users even if they are not logged in, I would like to sort them by uid and stuff if possible. The particular server is running FC5 but it would be good if it was general.

Cheers,
Phil
 
Old 07-05-2006, 02:33 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,378

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
cat /etc/passwd
or
getent passwd
 
Old 07-09-2006, 04:11 AM   #3
sniff
Member
 
Registered: Jan 2003
Location: Durham UK
Distribution: openSUSE 12.2/3 x86_64, Debian
Posts: 307

Original Poster
Rep: Reputation: 42
Hello,
Thank you, just what I needed.

Cheers,
Phil
 
Old 07-09-2006, 04:29 AM   #4
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
The /etc/passwd file will also contain system users. You could filter out the users how don't have a home directory.

sudo cat /etc/passwd | grep '/home'
 
Old 07-09-2006, 11:02 AM   #5
hepburnenthorpe
Member
 
Registered: Jun 2006
Location: Sydney
Distribution: Gentoo + Debian
Posts: 132

Rep: Reputation: 15
You could then trim this down even further to only recieve each username instead of the whole line.
Code:
sudo cat /etc/passwd | grep '/home' | cut -d : -f 1

Last edited by hepburnenthorpe; 07-09-2006 at 11:52 AM.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a single command to list all hardware installed (command line)? davee Linux - Hardware 6 02-28-2009 07:19 PM
Putting together a list of user accounts. kemplej Linux - General 1 01-16-2006 10:47 AM
List all user accounts on a system? bullium Linux - General 2 04-18-2005 10:07 AM
How do I create accounts, groups and so on only using the command line? brynjarh Linux - Newbie 2 07-07-2004 01:42 PM
disabling user accounts via command line n1wil Linux - Security 3 07-25-2003 05:11 PM


All times are GMT -5. The time now is 02:58 AM.

Main Menu
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