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 分钟前
Linux vimgrep 详解
linux·vim
呉師傅33 分钟前
佳能iR-ADV C5560复印机如何扫描文件到电脑
运维·网络·windows·计算机外设·电脑
麦子邪40 分钟前
C语言中奇技淫巧04-仅对指定函数启用编译优化
linux·c语言·开发语言
半梦半醒*1 小时前
Linux网络管理
linux·运维·网络·centos·运维开发
破刺不会编程1 小时前
linux线程概念和控制
linux·运维·服务器·开发语言·c++
华强笔记1 小时前
C程序内存布局详解
服务器·c语言
神秘人X7071 小时前
Linux网络配置全攻略:IP、路由与双机通信
linux·网络·tcp/ip
wxjlkh1 小时前
powershell 批量测试ip 端口 脚本
java·服务器·前端
翟天保Steven2 小时前
Ubuntu-安装Epics教程
linux·ubuntu·epics
Nightwish52 小时前
Linux随记(二十一)
linux·运维·服务器