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 ~]# 
相关推荐
yyuuuzz7 分钟前
中小企业出海上云:一次服务器选型踩坑记录
运维·服务器
Tassel_YUE14 分钟前
非 ansible 主机批量执行命令方法:psssh 和 pscp(随手记)
linux·网络·ssh·scp·ansible
脚踏实地,坚持不懈!22 分钟前
Android 上层卡顿在内核中的反应(基于 Linux v7.2.2)
android·linux·运维
H_oRIZoN_27 分钟前
Linux入门DAY36(TCP 并发服务器)
linux·服务器·tcp/ip
Shadow(⊙o⊙)30 分钟前
TCP传输深层原理+优秀的可靠性、效率优化机制
服务器·网络·tcp/ip
灵晔君33 分钟前
【Linux】基础IO(一)——文件、上层C库文件操作、底层linux原生IO
linux·运维·c语言
小五传输38 分钟前
聚焦卫健数字化建设 文件传输服务器守护跨机构敏感医疗数据交换
大数据·运维·安全
机器人梦想家43 分钟前
Debian 12/13 关闭开机图形界面(仅保留命令行)
运维·debian
IMPYLH1 小时前
HTML 的 <option> 元素
服务器·数据库·html
Fcy6481 小时前
Linux下 应⽤层⾃定义协议与序列化(JSON方法)
linux·json