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 ~]# 
相关推荐
志栋智能10 分钟前
超自动化安全:构建智能安全运营的神经系统
大数据·运维·网络·人工智能·安全·自动化
我先去打把游戏先22 分钟前
Ubuntu虚拟机(服务器版本)Git卸载完全教程——彻底移除与清理配置
服务器·git·单片机·嵌入式硬件·物联网·ubuntu·51单片机
着迷不白23 分钟前
四、Linux 文件权限+sudo权限委派+IO重定向+vim高级
linux·运维·服务器
WhoAmI25 分钟前
Linux 服务器挂载 LVM 逻辑卷全流程记录与问题排查
linux·服务器
zincsweet35 分钟前
进程同步与通信:System V 消息队列 + 信号量一站式解析
linux
是有头发的程序猿38 分钟前
AI Agent电商自动化实战:淘宝商品详情API无人化采集与分析教程
运维·人工智能·自动化
取经蜗牛38 分钟前
Docker 常用命令全面总结
运维·docker·容器
quan_泉1 小时前
DIDCTF 取证初学者
java·服务器·前端
RisunJan1 小时前
Linux命令-nohup(使进程忽略挂起(HUP)信号并在后台继续运行)
linux·运维·服务器