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 ~]# 
相关推荐
顾安r9 小时前
11.8 脚本网页 推箱子
linux·前端·javascript·flask
___波子 Pro Max.10 小时前
Linux source命令详解与应用场景
linux
橘子1310 小时前
Linux网络基础(一)
linux·网络·arm开发
你想考研啊12 小时前
linux安装jdk和tomcat和并自启动
java·linux·tomcat
chevysky.cn13 小时前
Jenkins自动部署CI/CD
运维·ci/cd·jenkins
习惯就好zz14 小时前
WSL2 安装Ubuntu卡在安装进度0%无响应问题解决
linux·windows·ubuntu·wsl·wsl2
躲猫猫的喵喵16 小时前
Ubuntu2204降内核版本
linux·运维·服务器·ubuntu
昌sit!16 小时前
Linux系统性基础学习笔记
linux·笔记·学习
zdslovezy16 小时前
CentOS 系统升级 OpenSSH 和 OpenSSL 的完整方案
linux·运维·centos
HIT_Weston17 小时前
18、【Ubuntu】【远程开发】技术方案分析:私网ip掩码
linux·tcp/ip·ubuntu