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 ~]# 
相关推荐
小生迷途知返9 分钟前
影响巨大!Linux 提权大洞速速复现!!!暂无补
linux·运维·服务器
FreeBuf_29 分钟前
Claude Mythos Preview 实现自动化漏洞研究突破,可构建PoC漏洞利用链
运维·自动化
风静如云37 分钟前
VMware:下载
运维
IMPYLH1 小时前
Linux 的 wc 命令
linux·运维·服务器·前端·bash
ElevenS_it1881 小时前
Redis监控实战:内存使用+命中率+连接数三类核心指标接入Zabbix+分级告警完整配置方案
运维·网络·redis·mybatis·zabbix
zxy6444924731 小时前
Centos7.9编译安装PHP7.4
linux·运维·服务器
无限进步_1 小时前
【Linux】从冯诺依曼到操作系统:理解计算机运行的基本脉络
linux·运维·服务器
happybasic1 小时前
Python库升级标准流程~
linux·前端·python
Rabbit_QL1 小时前
【ln -s】Linux 软链接在大模型部署中的应用
linux·运维·服务器
LT10157974442 小时前
2026年超自动化平台选型指南:全流程智能协同适配
运维·人工智能·自动化