LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to list existing users? (http://www.linuxquestions.org/questions/linux-newbie-8/how-to-list-existing-users-337445/)

stefaandk 06-26-2005 07:18 PM

How to list existing users?
 
Hi,

Looking for a command that shows me which users currently exist.

Cheers,

Tinkster 06-26-2005 07:19 PM

cat /etc/passwd

stefaandk 06-26-2005 07:31 PM

off course, thx!

stefaandk 06-27-2005 10:08 PM

Following up from this is there also a way to list groups rather then users?

Matir 06-27-2005 10:17 PM

cat /etc/group

:)

linuxlinux 03-28-2006 07:05 PM

cat /etc/group |grep [5-9][0-9][0-9]

if you don't want to list all the group

Cindy5419 03-28-2006 07:32 PM

I'm just a newbie as well, but couldn't you just use "who" to see who is logged on to the system? Also, I'm not sure but can't you also use "groups" for the groups?

reddazz 03-28-2006 07:44 PM

Quote:

Originally Posted by Cindy5419
I'm just a newbie as well, but couldn't you just use "who" to see who is logged on to the system? Also, I'm not sure but can't you also use "groups" for the groups?

"groups" will only show group info about yourself or a specific user. "who" will only list people logged into the system, but not every user that has an account on the system.

Tinkster 03-30-2006 01:11 AM

Quote:

Originally Posted by linuxlinux
cat /etc/group |grep [5-9][0-9][0-9]

if you don't want to list all the group

In fact it doesn't list a single one on my machine(s) ;}


Cheers,
Tink

demented_are_go 03-30-2006 08:49 AM

and... If you want just the username listed and not the whole line you can just use :

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

For groups... just replace /etc/passwd by /etc/group

linuxlinux 04-02-2006 07:58 PM

Quote:

Originally Posted by Tinkster
In fact it doesn't list a single one on my machine(s) ;}


Cheers,
Tink

Well when i tried with this on my machine this is what i found,

[root@unisa ~]# cat /etc/group |grep [5-9][0-9][0-9]
nfsnobody:x:65534:
Harrison:x:500:
steve:x:501:
superusers:x:502:
may:x:503:
test:x:504:
[root@unisa ~]#

Well may be i could be wrong, Sorry If is was wrong,

Cheers

Linux

Tinkster 04-03-2006 01:03 AM

Quote:

Originally Posted by linuxlinux
Well when i tried with this on my machine this is what i found,

[root@unisa ~]# cat /etc/group |grep [5-9][0-9][0-9]
nfsnobody:x:65534:
Harrison:x:500:
steve:x:501:
superusers:x:502:
may:x:503:
test:x:504:
[root@unisa ~]#

Well may be i could be wrong, Sorry If is was wrong,

Cheers

Linux

That's not "wrong" - but it's limited to your distros
view of the linux world. To create a group per user
is not necessary, it's something that DeadRat based
distros for instance will do.


Cheers,
Tink


All times are GMT -5. The time now is 05:17 AM.