最近需要获取group 对应的id 数字号码,突然想不起来怎么获得了,现在在这里进行备忘一下:

$ cut -d: -f3 < <(getent group sudo)
27
getent group sudo
cat /etc/group | grep -i sudo
$ echo "Group sudo with GID="$(cut -d: -f3 < <(getent group sudo))""
Group sudo with GID=27

保持更新,更多内容请关注 cnblogs.com/xuyaowen;

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

我之前也写过一个用户管理相关的博客,请访问下面的链接:

https://www.cnblogs.com/xuyaowen/p/linux-adduser.html linux 添加用户并设置主目录,shell 并赋予权限; is not in the sudoers file.  This incident will be reported.

参考链接:

https://askubuntu.com/questions/639990/what-is-the-group-id-of-this-group-name 

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄