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 ~]# 
相关推荐
泡沫冰@7 小时前
ECS 的介绍和使用
linux·服务器·网络
姜太小白7 小时前
【Linux】df -h 卡住问题的通用排查与解决方案总结
linux·运维·php
土星云SaturnCloud7 小时前
抽水蓄能设备智慧运营:基于土星云边缘计算实现机组全生命周期预测性维护
服务器·人工智能·ai·边缘计算
fengyehongWorld8 小时前
Linux 终端快捷键
linux·运维
hyf3266338 小时前
泛程序:从零开始搭建稳定程序项目框架
运维·服务器·爬虫·百度·seo
哎呦喂我去去去9 小时前
C#实现屏幕墙:同时监控多个电脑桌面(支持Windows、信创Linux、银河麒麟、统信UOS)
linux·windows·c#
为自己_带盐9 小时前
安敢越雷池一步?浅尝雷池WAF社区版
运维·web安全
NiceCloud喜云9 小时前
海外云服务器怎么选?适用场景、价格和避坑经验总结
运维·服务器
easy_coder10 小时前
Linux LVM 知识文档
linux·运维
小小的木头人11 小时前
Ubuntu 使用 udev + systemd + UUID 实现 USB 硬盘自动挂载
linux·运维·ubuntu