Sometimes it handy to deal with id’s instead of actual names. It makes your commands shorter.
So if you ever need to get the id’s of one user or a group in Linux, here’s the commands to run:
– id -u USERNAME – will give you the USERNAME ID;
– id -a USERNAME – will give, not only the ID of the user, but also all the groups the user is part of;
– id -g USERNAME – will give the ID of the user’s primary group;
– id -G USERNAME – will give you the ID of all groups the user is a member of;
If you just want to know the id of a group, the just run:
cat /etc/group | grep GROUPNAME
The third item of the colon(:) separated string is the group ID.
And there you have it.
Now you can find out every user and group ID’s.