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 ~]# 
相关推荐
使者大牙10 分钟前
【单点知识】CANopen实用协议介绍
服务器·网络·tcp/ip
狂野小青年14 分钟前
Jenkins如何添加全局凭证
运维·jenkins
m0_6948455717 分钟前
music-website 是什么?前后端分离音乐网站部署实战
linux·运维·服务器·云计算·github
you-_ling29 分钟前
Linux软件编程:Shell命令
java·linux·服务器
FairGuard手游加固30 分钟前
面具外挂检测方案
linux·运维·服务器
鲨辣椒1008630 分钟前
Linux软件编程基石——基础指令使用
linux·windows·microsoft
熬夜有啥好31 分钟前
Linux软件编程——Shell命令
linux·运维·服务器
一只自律的鸡32 分钟前
【Linux驱动】环境搭建和开发板操作 下篇
linux·运维·服务器
模型时代37 分钟前
Linux系统安全革命:Amutable公司推出全新验证完整性技术
linux·运维·系统安全
醇氧40 分钟前
【Linux】centos 防火墙学习
linux·学习·centos