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 ~]# 
相关推荐
S-码农1 小时前
Linux进程通信——消息队列
linux
SakitamaX1 小时前
KEEPALIVED介绍与实验与介绍
运维·keepalived
零基础的修炼2 小时前
Linux网络---数据链路层
linux·服务器·网络
楼田莉子2 小时前
Linux学习:线程的同步与互斥
linux·运维·c++·学习
小草儿7992 小时前
PG18备份恢复
linux·运维·服务器
Mikowoo0072 小时前
KaLi系统基本使用
运维·服务器
aaaffaewrerewrwer3 小时前
2026年常用HEIC转JPG在线工具推荐(支持批量转换)
服务器·图像处理
笑口常开xpr3 小时前
Linux 命 令 界 的 “王 炸 组 合”!Gitee 提 交 + 权 限 控 制 + 热 键 神 操,学 会 直 接 霸 屏 终 端!
linux·gitee·权限
Starry_hello world4 小时前
Linux http代码
linux·运维·http
wuxi_joe5 小时前
中国装备制造企业如何出海:以“配置管理”为核心构建全球竞争力
运维·人工智能·制造