Hi, Can some one please tell me how can I find the following.
List from /etc/passwd the UID and the user having the highest UID.
Hi, Can some one please tell me how can I find the following.
List from /etc/passwd the UID and the user having the highest UID.
/etc/passwd contains user information separated by colons. The user id is in the third column.
The sort command line tool can be used to sort the lines of a file. It has options, to choose which separator the columns are separated by, which column to sort by and whether to sort numerically or alphabetically.
So you can use sort to sort /etc/passwd by user id and then use tail to get the last line from that, which will contain the user with highest id.