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 ~]# 
相关推荐
一匹电信狗13 分钟前
【C++】C++风格的类型转换
服务器·开发语言·c++·leetcode·小程序·stl·visual studio
赖small强15 分钟前
Linux 页缓存(Page Cache)与回写(Writeback)机制详解
linux·页缓存(page cache)·回写(writeback)·脏页
中科米堆19 分钟前
中科米堆CASAIM自动化三维测量实现注塑模具快速尺寸测量
运维·人工智能·自动化
蓝冰印27 分钟前
HarmonyOS Next 快速参考手册
linux·ubuntu·harmonyos
---学无止境---37 分钟前
Linux中在字符串中查找指定字符的第一次出现位置的汇编实现
linux
老龄程序员44 分钟前
基于OpenIddict6.4.0搭建授权认证服务
运维·服务器·identityserver
tianyuanwo1 小时前
虚拟机监控全攻略:从基础到云原生实战
linux·云原生·虚机监控
别或许1 小时前
在centos系统下,安装MYSQL
linux·mysql·centos
丁丁丁梦涛1 小时前
CentOS修改MySQL数据目录后重启失败的问题及解决方案
linux·mysql·centos
黑马金牌编程1 小时前
Jenkins的Linux与window部署方式
linux·运维·windows·jenkins·持续集成·cicd