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 小时前
Linux.基础I/O
linux
Irissgwe3 小时前
三、Socket 编程 TCP
linux·网络·tcp·socket编程
%KT%3 小时前
Windows安装wsl2和docker desktop,部署qdrant向量数据库
运维·docker·容器
vortex53 小时前
Kali Linux 安装与使用 GitHub CLI (gh)教程
linux·运维·github
Garfield0_03 小时前
epoll软件架构及原理
linux
小匠石钧知3 小时前
01_以RockyLinux的镜像为基础_构建自己开发学习所需的镜像
linux·docker·jdk·mariadb
腾讯蓝鲸智云3 小时前
嘉为蓝鲸WeOps:47天周期常态化管理,全生命周期智能方案筑牢安全防线
运维·服务器·人工智能·自动化·云计算
学无止境_永不停歇3 小时前
从零手写高性能 C++ TCP 服务器框架(一):项目介绍
linux·服务器·c++·中间件
dingxingdi3 小时前
Linux 清理过程
linux·运维·服务器
szxinmai主板定制专家3 小时前
基于ZYNQ MPSOC ARM+FPGA的超高清实时图像采集与压缩系统设计
linux·运维·服务器·arm开发·人工智能·嵌入式硬件·fpga开发