Operating System - HP-UX
1823177 Members
3976 Online
109647 Solutions
New Discussion юеВ

Re: To list User using command line.

 
SOLVED
Go to solution
Kennethyap
Frequent Advisor

To list User using command line.

Dear Experts,
How to list all the users in the system using command line ?

Thks
14 REPLIES 14
Francesco Sarno
Frequent Advisor

Re: To list User using command line.

Hi! You can use the "w" comman or "users".

Bye, Francesco.
Steve Steel
Honored Contributor

Re: To list User using command line.

Hi

The commands

w
who -R
users

Give you options enough


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Kennethyap
Frequent Advisor

Re: To list User using command line.

w & users command will only output the current user login.

Any command to list out all the users that have a login account in the system ?
Ranjith_5
Honored Contributor

Re: To list User using command line.

#cat /etc/passwd. This will show an output similar to the following.From this you can find out all the user accounts including system accounts.

root:uXkeN0l2i/p1A:0:3::/:/sbin/sh
daemon:*:1:5::/:/sbin/sh
bin:*:2:2::/usr/bin:/sbin/sh
sys:*:3:3::/:
adm:*:4:4::/var/adm:/sbin/sh
uucp:*:5:3::/var/spool/uucppublic:/usr/lbin/uucp/uucico
lp:*:9:7::/var/spool/lp:/sbin/sh
nuucp:*:11:11::/var/spool/uucppublic:/usr/lbin/uucp/uucico
hpdb:*:27:1:ALLBASE:/:/sbin/sh
nobody:*:-2:-2::/:
www:*:30:1::/:
smbnull:*:101:101:DO
webadmin:*:40:1::/usr/obam/server/nologindir:/usr/bin/false
mysql:*:102:102::/home/mysql:/sbin/sh
iwww:*:103:1::/home/iwww:/sbin/sh
owww:*:104:1::/home/owww:/sbin/sh
master:CY/R.OYATn7Rs:105:20:portal
tmersrvd:*:59999:59999:RESERVED



Regards,
Syam
Kennethyap
Frequent Advisor

Re: To list User using command line.

Have any command line to do this ? In the system have a lot of users around 200+
avis_1
New Member

Re: To list User using command line.

Hi,

#who -R
#w
#cat /etc/passwd
#users


avis
Ramkumar Devanathan
Honored Contributor

Re: To list User using command line.

$ cut -d: -f1 /etc/passwd

Hth.
- ramd.
HPE Software Rocks!
RAC_1
Honored Contributor

Re: To list User using command line.

check the command logins
logins -a --> all user's on system and details.
logins -u --> user logins
logins -s --> system users.

Hope this helps.

Anil
There is no substitute to HARDWORK
Abhijit_9
Occasional Contributor

Re: To list User using command line.

Hi,

You can use lot of commands for this.
1. w or who or who -R
2. users

Hope this helps.

Regards,
Abhijit Roy
BONNAFOUS Jean Marc
Trusted Contributor

Re: To list User using command line.

Hi,

grep "sh$" /etc/passwd |cut -d: -f1

give you the list of all users with shell access (sh or ksh or rsh ,...).

Rgds

JMB
Si vous ne faites jamais de b├йtises, c'est que vous ne faites rien de difficile. Et ├зa c'est une grosse b├йtise.
Ronald Schwartz_1
Frequent Advisor

Re: To list User using command line.

logins is the command you need. There are options, check the man pages, that allow you to refine your listing. You have to be root for this command.
Ron
twang
Honored Contributor
Solution

Re: To list User using command line.

To list all user login data:
# listusers
mysql
oracle ,,,
smbnull DO NOT USE OR DELETE - needed by Samba
sshd sshd privsep
RUET
Regular Advisor

Re: To list User using command line.

try also the unix command pwget which is able to look at /etc/passwd, NIS

You have the same for group : grget
Muthukumar_5
Honored Contributor

Re: To list User using command line.

logins -uax --> will all relavent informations to user accounts.

hth.
Easy to suggest when don't know about the problem!