Introduction

In this article our objective is to verify if user account exists in Redhat enterprise Linux machine running with the Operating system version 6.5.

Process

Step 1: Login to server with Username and password.

Step 2: Run following command to find the user details.

Syntax:

$ cat /etc/passwd | grep <username>

Step 3: Following are a few examples to find the user details:

[avula@wikiconsole /]$ cat /etc/passwd | grep avula

avula:x:457057:200:Venkat Avula, abc:/home/isd/venkat:/bin/bash

(or)

[avula@wikiconsole /]$ egrep -i “^avula” /etc/passwd

avula:x:457057:200:Venkat Avula, abc:/home/isd/venkat:/bin/bash

(or)

[avula@wikiconsole /]$ awk -F’:’ ‘/^avula/{print $1}’ /etc/passwd

avula

Step 4: If you wish to find the group details along with the username, please use following command:

$ id <username>

Step 5: Following is an example to find the group and user details:

[avula@ wikiconsole /]$ id avula

uid=457057(avula) gid=200(isd) groups=200(isd)

Conclusion

You should now have a pretty good idea on How to verify if user exists in Linux / UNIX host.

If you like our article please share and Subscribe to our Facebook page.