linux-command/command/users.md

43 lines
790 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

users
===
打印当前主机所有登陆用户的名称。
## 概要
```shell
users [OPTION]... [FILE]
```
## 主要用途
- 每个显示的用户名对应一个登录会话;如果一个用户有不止一个登录会话,那他的用户名将显示相同的次数。
## 选项
```shell
--help 显示帮助信息并退出。
--version 显示版本信息并退出。
```
## 参数
FILE可选记录用户当前登录情况的文件默认使用 `/var/run/utmp` 、`/var/log/wtmp`。
## 返回值
返回0表示成功返回非0值表示失败。
## 例子
```shell
[root@localhost ~]# users
root root
```
### 注意
1. 该命令是`GNU coreutils`包中的命令,相关的帮助信息请查看`man -s 1 users``info coreutils 'users invocation'`。