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 ~]# 
相关推荐
ノBye~几秒前
Docker Compose
运维·docker·容器
白慕慕5 分钟前
tcp传输
linux·网络协议·tcp/ip
Mr成文7 分钟前
【Linux/Ubuntu】OpenCode +Oh My OpenAgent安装配置实践
linux·运维·ubuntu
超b小哥8 分钟前
【超详细】Claude Code Ubuntu平台完整部署指南
linux·人工智能·ubuntu·ai·claude code
原来是猿9 分钟前
为什么要配置环境变量?
linux·数据库·python
牢七9 分钟前
白盒123
linux·windows·microsoft
kyle~9 分钟前
操作系统---指令/调用体系(特权、访管/陷入、系统调用)
linux·操作系统
yhole13 分钟前
Nginx解决前端跨域问题
运维·前端·nginx
m0_7381207214 分钟前
渗透测试——Ripper靶机详细横向渗透过程(rips扫描文件,水平横向越权,Webmin直接获取root权限)
linux·网络·数据库·安全·web安全·php
小白学鸿蒙14 分钟前
服务器可视化部署静态网站或者搭建博客论坛-小白版
运维·服务器