Linux命令(115)之whoami

linux命令之whoami

1.whoami介绍

linux命令whoami是用来显示当前会用用户名称

2.whoami用法

whoami 参数

|-----------|--------|
| 参数 | 说明 |
| --help | 显示帮助信息 |
| --version | 显示版本信息 |
[whoami参数]

3.实例

3.1.显示帮助信息

命令:

whoami --help

复制代码
[root@rhel77 ~]# whoami --help
Usage: whoami [OPTION]...
Print the user name associated with the current effective user ID.
Same as id -un.

      --help     display this help and exit
      --version  output version information and exit

GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
For complete documentation, run: info coreutils 'whoami invocation'
[root@rhel77 ~]# 

3.2.显示版本信息

命令:

whoami --version

复制代码
[root@rhel77 ~]# whoami --version
whoami (GNU coreutils) 8.22
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Richard Mlynarik.
[root@rhel77 ~]# 

3.3.显示当前会话用户名称

命令:

whoami

复制代码
[root@rhel77 ~]# whoami
root
[root@rhel77 ~]# 

等价于

id -un

复制代码
[root@rhel77 ~]# id -un
root
[root@rhel77 ~]# 
相关推荐
青禾83711 小时前
Linux 操作系统入门指南:从目录结构到常用命令
linux·运维·服务器
zhengqweasd12 小时前
流量没跑满、带宽空闲,业务依然卡顿
运维·服务器·网络
闖6412 小时前
入门Linux操作系统|零基础吃透原理、目录、权限、常用命令
linux
bruk_spp13 小时前
linux pinctrl
linux
M哥支付13 小时前
高频交易优选方案:银联快捷支付通道
服务器·网络·其他·微信·金融
Y38153266213 小时前
Docker Compose 服务依赖与健康检查:healthcheck 让容器按正确顺序启动
运维·docker·容器
稳联技术老娜14 小时前
伺服内嵌EtherNet IP方案:嵌入式小板SPI通讯固件Demo程序适配改造
运维·服务器·网络
en.en..14 小时前
Linux系统编程:fcntl 与 ioctl
linux·运维·服务器
自动化监测Learner14 小时前
Navicat Premium 17 中文版安装教程(2026最新版)
java·linux·数据库
荣合技术服务15 小时前
Codex 实战:用 AI 写运维脚本
运维·codex