Linux id命令

更新时间: 2019-10-16 12:40

Linux id命令用于显示用户的ID,以及所属群组的ID。

id会显示用户以及所属群组的实际与有效ID。若两个ID相同,则仅显示实际ID。若仅指定用户名称,则显示目前用户的ID。

语法

id [-gGnru][--help][--version][用户名称]

参数说明

  • -g或--group  显示用户所属群组的ID。
  • -G或--groups  显示用户所属附加群组的ID。
  • -n或--name  显示用户,所属群组或附加群组的名称。
  • -r或--real  显示实际ID。
  • -u或--user  显示用户ID。
  • -help  显示帮助。
  • -version  显示版本信息。

实例

显示当前用户信息

# id //显示当前用户ID
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel) context=root:system_r:unconfined_t

显示用户群组的ID

# id -g
0

显示所有群组的ID

# id -g
0 1 2 3 4 5 6 10

显示指定用户信息

# id hnlinux
Bad Blood

Bad Blood

John Carreyrou / Knopf / 2018-5-21 / USD 27.95

The full inside story of the breathtaking rise and shocking collapse of Theranos, the multibillion-dollar biotech startup, by the prize-winning journalist who first broke the story and pursued it to t......一起来看看 《Bad Blood》 这本书的介绍吧!

CSS 压缩/解压工具

CSS 压缩/解压工具

在线压缩/解压 CSS 代码

URL 编码/解码

URL 编码/解码

URL 编码/解码

XML、JSON 在线转换

XML、JSON 在线转换

在线XML、JSON转换工具