Skip to main content

Posts

Showing posts from 2026

Linux variables to get UID/GID

User ID(UID), GID (Group ID) in Linux are numerical identifiers to set access to files, directories and system resources, just like rwx which in octal equivalent is r=4, w=2, x=1 and the desperate permission which will equal to 777.  777 is quite useful when nothing is working and an easy way out but yes use sparingly. UID and GID can be used also to restrict permissions or access. Quite a few ways to get UID value for the current login user. At terminal typing: echo "$UID" id -u echo/run/user/$UID All commands above are the same, get the user id of the currently logged in user. To get the GID, or the group membership of the currently logged in user is quite straight forward, at terminal type: id The output will be the  group-id(name of the group) and those are the group membership of the currently logged in user. id -Gn will just list the groups without the GID. id -G will just list the GIDs without name group Another quite useful variable, if let's say someone is asking...