-
-
Save blackpioter/e2abe236c09830efcd319457d4da5a54 to your computer and use it in GitHub Desktop.
Get the uid, gid and user groups without touching /etc/passwd or running the `id` command
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
awk -F: 'END {print "uid:"u" gid:"g" groups:"gg}{if($1=="Uid"){split($2,a," ");u=a[1]}if($1=="Gid"){split($2,a," ");g=a[1]}if($1=="Groups"){gg=$2}}' /proc/self/status |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment