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 ~]# 
相关推荐
小宇的天下2 分钟前
Calibre 3Dstack --每日一个命令days8【connected】(3-8)
运维·服务器·性能优化
ICT系统集成阿祥4 分钟前
服务器网卡绑定(bond)7种模式详解
运维·服务器·bond·网卡绑定·服务器链路聚合
wulalalalalalalal5 分钟前
Linux 内网服务器通过代理访问外网
linux·运维·服务器
C_心欲无痕7 分钟前
ts - 模板字面量类型与 `keyof` 的魔法组合:`keyof T & `on${string}`使用
linux·运维·开发语言·前端·ubuntu·typescript
fy zs9 分钟前
网络编程套接字
linux·服务器·网络·c++
乾元12 分钟前
无线定位与链路质量预测——从“知道你在哪”,到“提前知道你会不会掉线”的网络服务化实践
运维·开发语言·人工智能·网络协议·重构·信息与通信
望眼欲穿的程序猿16 分钟前
基于Linux&MacOS 开发Ai8051U
linux·运维·macos
飞飞传输17 分钟前
适配信创环境的传输系统推荐:助力企业数据安全合规传输!
大数据·运维·安全
OpsEye18 分钟前
Redis 内存碎片的隐形消耗——如何用 memory purge 命令释放空间?
运维·网络·数据库·redis·缓存·内存·监控
Bigbig.20 分钟前
驱动工程师面试题 - 操作系统1
linux·开发语言·面试·硬件架构