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 ~]# 
相关推荐
编织幻境的妖2 分钟前
Docker底层工作原理
运维·docker·容器
TDengine (老段)15 分钟前
TDengine IDMP 赋能新能源:光伏电站智能运维实践
大数据·运维·数据库·物联网·时序数据库·tdengine·涛思数据
小武~36 分钟前
#嵌入式Linux电源管理实战:深入解析CPU调频governor原理与优化
linux
gcfer36 分钟前
Docker 介绍和常用命令
运维·docker·容器
i***48612 小时前
Nginx中$http_host、$host、$proxy_host的区别
运维·nginx·http
Fɪʀᴇᴡᴏʀᴋs3 小时前
Oceanbase数据库—基于社区版本的数据库集群管理
运维·数据库·oceanbase
HalvmånEver3 小时前
Linux:基础开发工具(五)
linux·运维·服务器
qq_278984133 小时前
ubuntu vlan网络设置
linux·服务器·网络
q***58193 小时前
基础篇:Linux安装redis教程(详细)
linux·运维·redis
小二·3 小时前
Linux 高频面试题(50道 + 详细答案)
linux·运维·服务器