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 ~]# 
相关推荐
MarkHD7 小时前
自动化桌面整理脚本——用GUI自动化终结混乱(Day 19-20)
运维·自动化
funnycoffee1237 小时前
华为,华三交换机开启snmp的命令
服务器·华为·华为snmp·华三snmp
AD钙奶-lalala7 小时前
Error starting ApplicationContext. To display the condition evaluation···
linux·运维·服务器
市安7 小时前
基于Debain构建Ngxin镜像
运维·nginx·docker·云原生·容器·debian·镜像
未来之窗软件服务7 小时前
平台对接(2)美团/抖音/饿了么/有赞/微信/京东券核销服务商模式—东方仙盟
大数据·运维·微信·平台对接·仙盟创梦ide·东方仙盟·东方仙盟sdk
阿正的梦工坊7 小时前
Nginx(发音:engine x)是什么?
运维·nginx
71ber7 小时前
RHCSE 实战笔记: LVS 负载均衡集群深度解析
linux·服务器·lvs
未来之窗软件服务7 小时前
平台对接(1)美团/抖音/饿了么/有赞/微信/京东券核销—东方仙盟
服务器·微信·平台对接·仙盟创梦ide·东方仙盟·东方仙盟sdk
rpa研究爱好者8 小时前
灵梭rPA如何通过手机群控自动化处理亚马逊店铺的日常客服与消息回复
运维·自动化·rpa
Byte不洛8 小时前
TCP 服务器如何支持高并发?单进程、多进程、多线程模型详解
linux·网络编程·高并发·tcp·socket编程