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 ~]# 
相关推荐
Elihuss几秒前
关于RK3506 的MCU软复位后跑不起问题
linux·单片机·嵌入式硬件
小王C语言2 分钟前
Linux给指定用户添加sudo权限
linux·运维·服务器
IpdataCloud5 分钟前
游戏安全运营中,如何用IP代理识别服务快速检测作弊网络出口?操作指南来了
运维·网络·tcp/ip·安全·游戏
倔强的石头1065 分钟前
异构操作系统架构下的数据库表空间高级管理:路径兼容与自动化运维实战
运维·数据库·架构
誰能久伴不乏7 分钟前
从底层看透音视频架构:FFmpeg 实时视频推流深度解析
linux·c++·tcp/ip·ffmpeg
浪客灿心7 分钟前
Linux数据链路层
linux·网络
2301_816374339 分钟前
反向代理负载均衡实验
运维·负载均衡
落羽的落羽11 分钟前
【算法札记】练习 | Week3
linux·服务器·数据结构·c++·人工智能·算法·动态规划
阿洛学长13 分钟前
使用 Hexo+GitHub 搭建个人免费博客教程(小白)
运维·数据库·架构
科技AI训练师15 分钟前
2026年清虹分布式坐席系统如何破局技术内卷与运维成本困局
运维·分布式