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 ~]# 
相关推荐
布局呆星5 小时前
云服务器上部署单项目/多项目
运维·服务器
盐焗鹌鹑蛋5 小时前
【Linux】缓冲区
linux·运维·服务器
祈禾5 小时前
Redis三大缓存问题与分布式锁
运维·数据库·redis·笔记·分布式·缓存
ltl7 小时前
向量库与图 RAG:HNSW、DiskANN 到 GraphRAG
linux
ltl7 小时前
可观测性存储与成本:采样、下采样、冷热分层
运维
学代码的CJY7 小时前
Linux 库制作与原理:静态库、动态库、ELF 与动态链接完全指南
linux·运维·服务器
沸速存储8 小时前
CPU 和 GPU 核心差别在哪?为什么 AI 训练离不开 GPU
服务器·人工智能·科技·嵌入式硬件·电脑
SatanII8 小时前
403 禁地:Nginx 拒绝所有生者进入
运维·nginx
呱呱巨基9 小时前
Linux 查找命令
linux·笔记·学习·查找命令
路由侠内网穿透9 小时前
本地部署企业级快速开发平台芋道管理后台并实现外部访问
运维·服务器·网络·网络协议