How to get current user's primary group GID on Linux

Run

id_g_example.sh
id -g

to get the GID of the current user’s primary group. Example:

id_g_output.txt
$ id -g
1000

You can also get the GID of another user’s primary group:

id_g_root_output.txt
$ id -g root
0

 


Check out similar posts by category: Linux