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 ~]# 
相关推荐
weixin_3077791320 小时前
面向通用矩阵乘法(GEMM)负载的GPU建模方法:原理、实现与多场景应用价值
运维·人工智能·线性代数·矩阵·gpu算力
2301_7807896620 小时前
2025年UDP洪水攻击防护实战全解析:从T级流量清洗到AI智能防御
服务器·网络·人工智能·网络协议·安全·web安全·udp
不爱吃糖的程序媛20 小时前
OpenHarmony仓颉文档:全场景应用开发指南
运维·服务器
终端行者20 小时前
Nginx四层负载均衡配置 Stream模块使用
运维·nginx·负载均衡
小程故事多_8020 小时前
打破传统桎梏,LLM 让智能运维实现从 “自动化” 到 “自进化”
运维·人工智能·自动化·aigc
oh,huoyuyan20 小时前
火语言 RPA “按住滑块拖动到最右边” 自动化案例
运维·自动化·rpa
龙仔72521 小时前
n2n supernode Linux完整部署笔记,包含离线部署,
linux·运维·笔记·n2n·supernode
c++逐梦人21 小时前
进程控制(2)进程程序替换
linux·操作系统·进程
深耕AI21 小时前
【wordpress系列教程】07 网站迁移与备份
运维·服务器·前端·数据库
猎人everest21 小时前
Spring Cloud Alibaba 微服务架构拆分api和server的必要性
运维·微服务·架构