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 ~]# 
相关推荐
蘑菇丁18 分钟前
招聘大数据运维工程师(郑州)
大数据·运维
NiceCloud喜云30 分钟前
Claude Code 跑 HyperFrames 实测:本地生成 AI 视频素材全流程
java·运维·人工智能·自动化·json·音视频·飞书
似水এ᭄往昔30 分钟前
【Linux网络编程】--计算机网络基础
linux·网络·计算机网络
qq_3129201132 分钟前
服务器被攻击!完整安全加固清单汇总
运维·服务器·安全
leaves falling38 分钟前
深入理解Linux进程控制:从fork到exec,手写一个迷你Shell
linux·运维·服务器
思麟呀1 小时前
C++工业级日志项目(七)日志器核心
linux·开发语言·c++·windows
满天星83035771 小时前
【Git】原理及使用(二) (版本回退)
linux·git
cd_949217211 小时前
水处理市场升级,台州海德能环保科技凭技术创新与服务并重脱颖而出
大数据·运维·科技
Strugglingler1 小时前
【Linux Device Drivers-第九章 与硬件通讯 I/O端口,I/O内存】
linux·i/o端口·i/o内存
.YYY1 小时前
万字详解|Linux Chrony 时间服务完整学习手册
linux·运维