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 ~]# 
相关推荐
Decay__1 小时前
集群安装部署实战 —— kubeadm 搭建 3 控制面 + 3 工作节点高可用集群
运维·云原生·容器·kubernetes·k8s
禾小西2 小时前
Navicat 通过 SSH 跳板连接 PostgreSQL:双服务器配置与排障实录
服务器·postgresql·ssh
爆米花byh2 小时前
在RockyLinux9环境下安装Rust1.100.0环境
linux·rust
llilian_162 小时前
单北斗信创 NTP 服务器自主可控溯源要求
运维·服务器·功能测试·嵌入式硬件·51单片机·软件工程
爆米花byh3 小时前
在RockyLinux9环境下安装Manticore Search32.1.3单机版
linux·服务器·搜索引擎
华允物联-HUAIOT3 小时前
断线不可怕,可怕的是“假在线”:串口服务器的四道自愈防线
运维·服务器
大今野3 小时前
技能六 · Linux(CentOS 7)操作系统章节习题
linux·运维·centos·专转本
ynchyong3 小时前
PERC H330 Mini 挂 SATA 盘----DEL服务器
运维·服务器·del
tqs_123453 小时前
Agent治理与自动化评测体系
运维·人工智能·自动化·ai agent
yangmu32033 小时前
AI 辅助 EtherCAT 调试日志分析:从底层逻辑到工程实战
运维