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 ~]# 
相关推荐
lThE ANDE1 小时前
最完整版Linux安装Redis(保姆教程)
linux·运维·redis
yyuuuzz4 小时前
企业出海:技术部署与运维避坑
运维
郝亚军5 小时前
ubuntu通过samba,让win11可以访问其共享文件夹
linux·服务器·ubuntu
workflower5 小时前
人机交互部分OOD
运维·人工智能·自动化·集成测试·人机交互·软件需求
一个人旅程~5 小时前
旧电脑的“拯救者”?Linux Mint20.3是怎样适配软件硬件以及兼顾兼容与性能的平衡的?
linux·经验分享·电脑
农村小镇哥5 小时前
nginx服务器的介绍
运维·服务器·nginx
小夏子_riotous5 小时前
Docker学习路径——3、常用命令
linux·运维·服务器·学习·docker·容器·centos
其实防守也摸鱼6 小时前
无线网络安全---WLAN相关安全工具--kali(理论附题目)
linux·安全·web安全·学习笔记·kali·命令模式·wlan
uesowys8 小时前
CentOS Linux安装部署OpenClaw
linux·centos·安装部署openclaw
IMPYLH8 小时前
Linux 的 rm 命令
linux·运维·服务器·网络·bash