Update groups.md

更新文档内容
This commit is contained in:
ZhuangZhu-74 2020-05-09 11:41:40 +08:00 committed by GitHub
parent 0dd76a76d2
commit 5e34f192e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 15 deletions

View File

@ -1,37 +1,46 @@
groups
===
用来打印指定用户所属的工作组
打印指定用户所在组的名称。
## 补充说明
**groups命令** 在标准输入输出上输出指定用户所在组的组成员,每个用户属于`/etc/passwd`中指定的一个组和在`/etc/group`中指定的其他组。
### 语法
## 概要
```shell
groups(选项)(参数)
groups [OPTION]... [username]...
```
### 选项
## 主要用途
- 打印指定用户所在组的名称。
## 选项
```shell
-help显示命令的帮助信息
--version显示命令的版本信息。
--help 显示帮助信息并退出。
--version 显示版本信息并退出
```
### 参数
## 参数
用户名:指定要打印所属工作组的用户名
username可选可以是一到多个不提供时默认为当前用户
### 实例
## 返回值
返回0表示成功返回非0值表示失败。
## 例子
显示linux用户所属的组
```shell
groups linux
[root@localhost ~]# groups linux
linux : linux adm dialout cdrom plugdev lpadmin admin sambashare
```
### 注意
<!-- Linux命令行搜索引擎https://jaywcjlove.github.io/linux-command/ -->
1. 该命令等价于 `id -Gn`
2. 每个用户属于`/etc/passwd`中指定的一个组和在`/etc/group`中指定的其他组。
3. 该命令是`GNU coreutils`包中的命令,相关的帮助信息请查看`man -s 1 groups``info coreutils 'groups invocation'`。
<!-- Linux命令行搜索引擎https://jaywcjlove.github.io/linux-command/ -->