I try echo $GID but get nothing. However, I can get 1000 by using id -g, what's the differences between them ?
id -u => 1000
id -g => 1000
echo $UID => 1000
echo $GID =>
The output of id:
uid=1000(user) gid=1000(user) groups=1000(user),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),113(lpadmin),128(sambashare),999(docker)
The output of groups:
user adm cdrom sudo dip plugdev lpadmin sambashare docker
Ubuntu version:
Distributor ID: Ubuntu
Description: Ubuntu 16.04.6 LTS
Release: 16.04
Codename: xenial
bash -c 'echo $GID'andecho $GIDin terminal ? – Corey Mar 11 '19 at 06:42echo $GIDin my terminal would run it in zsh, since I use zsh as my shell. In your terminal, it might be run in bash. I usebash -c ...to run the command specifically in bash. – Olorin Mar 11 '19 at 06:46GIDexceptid -g? – Corey Mar 11 '19 at 06:48cat /etc/group | grep ^your_group_name | cut -d: -f3– Prvt_Yadav Mar 11 '19 at 06:54$GROUPSas a replacement ? – Corey Mar 11 '19 at 06:59