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 小时前
PX4各个模块的作用(3)
linux·stm32·嵌入式硬件·机器人·自动驾驶
会周易的程序员5 小时前
openplc runtimev4 Docker 部署
运维·c++·物联网·docker·容器·软件工程·iot
WJ.Polar5 小时前
FTP、Telnet、PPP、SNMP协议
服务器·网络
不爱缺氧i5 小时前
ubuntu离线安装mariadb
linux·ubuntu·mariadb
疯狂敲代码的老刘5 小时前
JDK 1.6到25 全版本网盘合集 (Windows + Mac + Linux)
java·linux·windows·macos·jdk
爆米花byh5 小时前
在RockyLinux9环境的Storm2.8.3单机版安装
linux·中间件·storm
纤纡.5 小时前
Linux 下 MySQL 数据类型与约束:第三章核心表格归纳与实战应用
linux·mysql
REDcker5 小时前
gRPC完整文档
服务器·网络·c++·网络协议·grpc
Highcharts.js5 小时前
如何设置自定义Highcharts导出服务器?
服务器·highcharts·自定义导出·导出服务器·导出模块·渲染功能
陈桴浮海5 小时前
【Linux&Ansible】学习笔记合集三
linux·运维·云原生·ansible