Listing Users in Linux
Wednesday, March 25, 2009 6:28Have you ever tried to list all registered users in linux? I tried it today. I hit the terminal with users and it responded with few names. I noticed that this is much less number of people than that I have registered in the system.
Oh! Where are the other users? I googled for a while and found out a quirk technique. The users command only lists the currenly logged users. To list all the registered users in Linux you should
cat /etc/passwd | cut -d’:’ -f1
This command will list all the registered users in the system.
I think a Little explanation is necessary.
cat – It joins all the strings in the file and prints it
/etc/passwd – This is the file where all the usernames along with their password is stored
| – Pipe the output to next program ;
cut – cut some portion of the every line in the file with the delimeter
-d – A switch of cat to define delimeter; here in the case :
-f – Select field. Here in this case select 1st field i.e f1
Happy reading
















