Linux命令:groups

打印指定用户所在组的名称。

2024-12-31 17:39:04

命令行command

概要

groups [OPTION]... [username]...

主要用途

  • 打印指定用户所在组的名称。

选项

--help       显示帮助信息并退出。
--version    显示版本信息并退出。

参数

username(可选):可以是一到多个,不提供时默认为当前用户。

返回值

返回0表示成功,返回非0值表示失败。

例子

显示linux用户所属的组

[root@localhost ~]# groups linux
linux : linux adm dialout cdrom plugdev lpadmin admin sambashare

注意

  1. 该命令等价于 id -Gn
  2. 每个用户属于/etc/passwd中指定的一个组和在/etc/group中指定的其他组。
  3. 该命令是GNU coreutils包中的命令,相关的帮助信息请查看man -s 1 groupsinfo coreutils 'groups invocation'

评论

静谧以待,您的评论将是点睛之笔

撰写首个评论,启程你的前端奇妙之旅

is a Wiki for programming enthusiasts and professionals, organizing knowledge on programming.

Connect With Me

I have a fair amount of knowledge of Javascript, Typescript, VueJs, and Nuxt. If you have an interesting idea, either open source or paid let's connect.

Sent Mail
© 2024-2025 © . All rights reserved.