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 ~]# 
相关推荐
咋的啥名都用不了呢~12 分钟前
Linux项目部署6(安装Elasticsearch)
linux
时间的拾荒人36 分钟前
Docker 入门实战:从核心概念、安装配置到镜像操作与 Dockerfile 定制
运维·docker·容器·eureka
光电笑映1 小时前
TCP 为什么可靠?从三次握手、滑动窗口到拥塞控制全面拆解(上)
运维·服务器·网络·udp
飞奔的瓜牛1 小时前
Linux 下使用 OpenSSL 生成自签名证书完整指南
运维·服务器·nginx
无奈笑天下1 小时前
银河麒麟桌面上USB打印机无法打印问题标准处理流程
linux·运维·网络协议
Decay__2 小时前
附 - 02・SQLServer 分库分表与中间件 —— 原生分区表、横向分库实践与联邦查询
运维·数据库·sql·mysql·架构
15Moonlight2 小时前
Linux 网络(11):IO 多路转接(select /poll/epoll)
linux·网络
峥嵘life3 小时前
Android16 热点「网络共享」开关的设计与实现
服务器·网络·microsoft
wno7044 小时前
CentOS下FTP服务搭建
linux·运维·centos
mylove_北极甜虾4 小时前
jenkins-01Jenkins 架构与任务调度
运维·jenkins