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 ~]# 
相关推荐
电商API_180079052475 小时前
京东商品详情API技术文章
大数据·运维·人工智能·网络爬虫
三言老师6 小时前
秘诀-如何远程SSN访问家里的八台电脑(frp 实操方案)
linux·运维·ssh
躺不平的理查德6 小时前
ARCH与交叉编译器的关系
服务器·arm
举手7 小时前
Dispatcher模块剖析
linux·c++
BTU_YC8 小时前
Docker Compose 部署 DozerDB 完整教程
运维·docker·容器
谢慧琼8 小时前
2026零基础做企业网站,低成本搭建官方网站
服务器·前端·javascript
allforgood9 小时前
运行容器
linux
Light_It10 小时前
Linux 内核参数 pci-stub.ids=
linux·kernel
RisunJan10 小时前
Linux命令-scriptreplay(终端会话回放)
linux·运维·chrome
spencer_tseng10 小时前
[kylin & linux] install docker
linux·docker·kylin