This week’s Read the Manual is about id: a tool I only learned the existence of while researching last week’s entry on lsof! It gives you users’ user names, group names, and numeric IDs for a given user. This is handy when you need one of those pieces to pass to some other data — like the user ID.
If you just run id, you get the user ID list for the current user. If you pass some other user name, you get the ID for that user.
The options are all just for variations on displaying the output, so this is pretty close to the Unix “do just one thing” philosophy. Some of those options:
-Fgives you the full name of the user (id -F→Chris Krychoon my Mac)-Ggives you the group IDs for the user, as numbers, “in no particular order”-ggives you the effective group ID as a number-ugives you the effective user ID as a number-nis a very helpful modifier for the-G,-g, and-uflags because it gives you the name of those values. Soid -ugives me501, butid -ungives mechris. Handy.-ris likewise a modifier on other flags; it gives you real rather than effective group or user IDs.
I don’t honestly know when I would need almost any of these, other than when trying to chase down some very weird system behavior — probably in conjunction with tools like ps and lsof, or even htop or procs.
Have you ever had cause to use them? I’d love to hear some details!