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 ~]# 
相关推荐
会周易的程序员1 小时前
microLog 的本地日志读取接口 log_reader — 本地日志文件读取工具开发指南
linux·物联网·架构·嵌入式·日志·iot·aiot
spider_xcxc1 小时前
Redis 数据库高质量实践指南(一)
运维·数据库·redis·oracle·云计算
yoothey1 小时前
报废审批流规则引擎设计——责任链模式完整实现
linux·开发语言·bash
2501_925963382 小时前
外设的常见问题
linux
2501_943782352 小时前
【共创季稿事节】摇骰子:用 ArkTS 实现随机动画与交互反馈
运维·nginx·交互·harmonyos·鸿蒙·鸿蒙系统
l1t2 小时前
在linux和windows中解决duckdb 1.6dev版本输出执行计划报错问题
linux·运维·数据库·windows·duckdb
tryCbest2 小时前
Python 文件操作
服务器·python
柳鲲鹏2 小时前
LINUX高通平台交叉编译地图软件GDAL
linux
fei_sun2 小时前
路径MTU发现
linux·运维·网络
负责的蛋挞2 小时前
异步HttpModule的实现方式
java·服务器·前端