How to find out user id on linux system

03 April 2009 | Howto | Tags: , , , , , , , ,

For a mount command I needed to find out what user id my user account had. There are several ways to find out. As root you could look into the passwd file (most likely /etc/passwd) or on OpenSuSE use the Yast user module. But I was looking for a way to find out my user id with my ordinary user account. The command I was looking for is id. Just open up a shell (konsole on KDE4) with your active user, type id and you get all the information about your user including groups and their ids. If you just want to know the user’s id, e.g. for a shell script use

id -u USERNAME

and you get back just the id of the user. Simple as that!


Leave a Reply