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 ~]# 
相关推荐
leoufung8 分钟前
逆波兰表达式 LeetCode 题解及相关思路笔记
linux·笔记·leetcode
鸠摩智首席音效师10 分钟前
如何在 Linux 中使用 dd 命令 ?
linux·运维·服务器
一夜空中最亮的星一32 分钟前
【Linux】ubuntu24.04 安装docker
linux·docker·eureka
赖small强37 分钟前
【Linux 网络基础】libwebsockets 技术文档
linux·网络·https·tls·lib·websockets
q***51891 小时前
ubuntu 安装 Redis
linux·redis·ubuntu
JuiceFS1 小时前
JuiceFS sync 原理解析与性能优化,企业级数据同步利器
运维·后端
q***47182 小时前
使用Canal将MySQL数据同步到ES(Linux)
linux·mysql·elasticsearch
Logan Lie2 小时前
Web服务监听地址的取舍:0.0.0.0 vs 127.0.0.1
运维·后端
Y淑滢潇潇3 小时前
RHCE 防火墙实验
linux·运维·rhce
wadesir3 小时前
当前位置:首页 > 服务器技术 > 正文Linux网络HSRP协议(实现路由器热备份与高可用性的实用指南)
linux·服务器·网络