Find a whether user exists or not.


 
Thread Tools Search this Thread
Operating Systems Solaris Find a whether user exists or not.
# 1  
Old 07-21-2010
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.
# 2  
Old 07-21-2010
Hi.

The id command is generally universally available.
# 3  
Old 07-21-2010
@ scottn

"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...
# 4  
Old 07-21-2010
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:
Code:
id jupp > /dev/null 2>&1 || echo 'User not found!'

This User Gave Thanks to zaxxon For This Post:
# 5  
Old 07-21-2010
finger is also available on Solaris.

Also getent should be available.
This User Gave Thanks to Scott For This Post:
# 6  
Old 07-21-2010
Just saw the answer. Then do a simple grep on the /etc/passwd like you already did but without that more and pipe.
# 7  
Old 07-21-2010
@zaxxon

I am sorry i guess i confused you ....
the main use is to display all the attributes of the user if user account exists....
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Ldap user does not exists

Hi all, Hope everyone doing good. Let me come to point, i have setup-ed a LDAP server and client machines Server works perfect, while make a search from client machine it too get the Query from LDAP server, But while i switch user it says user not exists # su - babin su: user babin does... (3 Replies)
Discussion started by: babinlonston
3 Replies

2. Shell Programming and Scripting

How to find out whether a file exists with the help of regular expression?

Hi all I have a list of file names in array. But this file names are not exact. so i want to search whether a file exists or not using regular expression. code snippet: if ; then echo "File exists" else echo "File does not exits" fi over here "*EQST*" should be treated as a regular... (4 Replies)
Discussion started by: Ganesh_more
4 Replies

3. UNIX for Dummies Questions & Answers

Statement to find if an entry exists in a file

I need to check if an entry input by the user is in a file. If so, I need to run a command, and if it does not exist then it should output entry does not exist. So I have so far... echo "Enter record:" read record //command || //command Can I use an if statement to do this? (3 Replies)
Discussion started by: itech4814
3 Replies

4. Shell Programming and Scripting

Find records between two files which are not exists in one another in one

Hello all, Would like to know how to find records between two files which are not exists in one another in one. For example: I've two files "fileA" and "fileB" and want to find record from "fileB" which does not exists in "fileA". fileA -------- ABCD DEFG GHIJ KLMN NOPQ RSTU VUWX... (5 Replies)
Discussion started by: nvkuriseti
5 Replies

5. Shell Programming and Scripting

Check if user exists shell

Hello! I'm stuck with a problem that i can't solve. I'm very new to unix, linux and shell scripting i might add. I'm trying to create a script that will execute as follows: First start the script - sh exist Then the prompt asks the user to input a username to check if it exists within the... (6 Replies)
Discussion started by: bib2006
6 Replies

6. Shell Programming and Scripting

find, if exists then append for file with same name

I will have to process multiple files with same name everyday. My requirement is: If on a certain day I see that filename.txt exists then the contents of the filename.txt would be added/append to the former file contents.Each time it sees the file the content would be added.But the header ... (8 Replies)
Discussion started by: RubinPat
8 Replies

7. HP-UX

System wide user thread limit. does that exists :?

Hi all, Is there any system wide limit on number of user threads. I only find nkthread as a tunable parameter,apart from the `per process limit`. (1 Reply)
Discussion started by: Krsh
1 Replies

8. Shell Programming and Scripting

Good (reliable!) check if user exists

Hi all, I've been trying to find a good check I can put it in to a shell script to see if a given user exists. Some of the things I've thought about is checking whether they have a home directory, but not all users have a home directory. I've thought about grepping the /etc/passwd file for... (4 Replies)
Discussion started by: _Spare_Ribs_
4 Replies

9. Shell Programming and Scripting

-s option to find object exists not working.

is there a direct command to find whether directory is empty, -s option doesn't seem to work. Mark. (2 Replies)
Discussion started by: markjason
2 Replies

10. SCO

Need Script to check whether user exists in the remote machine

Hi All, I am new to shell scripting. Can someone let me know, how to check whether the user exists in the remote system? I am building a new unix box and before I proceed installing the appliation , I want to check whether the required users are created in the system . how to do this ?... (1 Reply)
Discussion started by: Srini75
1 Replies
Login or Register to Ask a Question