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 ~]# 
相关推荐
Bulestar_xx29 分钟前
vulnhub DC-4 walkthrough (含非预期)
linux·网络·安全
涛ing1 小时前
【5. C++ 变量作用域及其深入探讨】
java·linux·c语言·开发语言·c++·ubuntu·vim
大秦王多鱼1 小时前
Kafka ACL(访问控制列表)介绍
运维·分布式·安全·kafka·apache
曾经的三心草1 小时前
小程序项目-购物-首页与准备
运维·服务器·小程序·项目·购物
蓝染k9z3 小时前
在Ubuntu上使用Docker部署DeepSeek
linux·人工智能·ubuntu·docker·deepseek+
苏-言4 小时前
Linux环境下的Java项目部署技巧:安装 Mysql
linux·运维·mysql
代码对我眨眼睛5 小时前
重回C语言之老兵重装上阵(十三)C 预处理器
linux·c语言
张文君5 小时前
ubuntu直接运行arm环境qemu-arm-static
linux·arm开发·ubuntu
lljss20205 小时前
在 WSL2 中重启 Ubuntu 实例
linux·运维·ubuntu
engchina5 小时前
在 Ubuntu 上安装 Node.js 23.x
linux·ubuntu·node.js