Find a whether user exists or not.

Hi all,

to find a user whether he had an account on AIX box i will use commands like
"finger" , "lsuser".

I am new to solaris and we are migrating to solaris.

now i am using " more /etc/passwd | grep -i <UserID> " to find a user present in that solaris box or not.

Are der any similar commands present in soalris .
Could any one please tell a command which will help me to list the user....

Thanks in advance.

Hi.

The id command is generally universally available.

"ID" only gives uid and primary group.... but i want to check all attributes for the user like shell and home dir and description as welll...

I guess the command id <username> is available on every Unix/Linux.
Using more on a file to pipe it into grep is no good usage. grep takes filenames as parameter directly. Also is more for page wise listing of a file.

You can try something like:

id jupp > /dev/null 2>&1 || echo 'User not found!'
1 Like

finger is also available on Solaris.

Also getent should be available.

1 Like

Just saw the answer. Then do a simple grep on the /etc/passwd like you already did but without that more and pipe.

I am sorry i guess i confused you ....
the main use is to display all the attributes of the user if user account exists....

Yeah, I was too slow to cope with^^
Anyway, maybe this is a help in future:

Rosetta Stone for Unix

You can mark the OS you want to compare and checkout which command you are looking for.

Yes, of course :smiley:

I never remember to mention that great link!

Heres a command I've found myself more frequently using:

logins -oxl <userid>

Easily to cut as well.