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 分钟前
DSC+DW实时+异步搭建部署
运维
大耳朵土土垚11 分钟前
【Linux 】开发利器:深度探索 Vim 编辑器的无限可能
linux·编辑器·vim
极客小张19 分钟前
基于STM32MP157与OpenCV的嵌入式Linux人脸识别系统开发设计流程
linux·stm32·单片机·opencv·物联网
x66ccff24 分钟前
【linux】4张卡,坏了1张,怎么办?
linux·运维·服务器
jjb_23644 分钟前
LinuxC高级作业2
linux·bash
OH五星上将1 小时前
OpenHarmony(鸿蒙南向开发)——小型系统内核(LiteOS-A)【扩展组件】上
linux·嵌入式硬件·harmonyos·openharmony·鸿蒙开发·liteos-a·鸿蒙内核
隔窗听雨眠1 小时前
基于Prometheus和Grafana的现代服务器监控体系构建
服务器
拾光师1 小时前
linux之网络命令
linux·服务器·网络
毕设木哥2 小时前
25届计算机专业毕设选题推荐-基于python+Django协调过滤的新闻推荐系统
大数据·服务器·数据库·python·django·毕业设计·课程设计
我命由我123452 小时前
GPIO 理解(基本功能、模拟案例)
linux·运维·服务器·c语言·c++·嵌入式硬件·c#