Linux Whoami命令教程来查找当前用户

Linux provides different tools to identify current and related users. whoami is one of the command that is used to  display information about the current user.

Linux提供了不同的工具来识别当前用户和相关用户。 whoami是用于显示有关当前用户信息的命令之一。

打印当前用户 (Print Current User)

We can print current user with whoami command like below.

我们可以使用whoami命令打印当前用户,如下所示。

Print Current User 
Print Current User
打印当前用户

使用我是谁(Use who am i)

Another usage option of the whoami command is using it separately. So we can simply write who am i  into the terminal like in English language and we will get detailed information about the current user like below.

whoami命令的另一个用法选项是单独使用它。 因此,我们可以像英语一样简单地在终端中输入“ who am i如下所示,我们将获得有关当前用户的详细信息。

$ who am i
Use who am i
Use who am i
使用我是谁

印刷版(Print Version)

I know it is not important but we can also print the version of the whoami command with the --version  option like below.

我知道这并不重要,但是我们也可以使用--version选项打印whoami命令的--version如下所示。

$ whoami

打印当前登录的用户 (Print Currently Logged In Users)

We can also print currently logged in users into a Linux system with w command. This command will also provide information like TTY ofthe user , Login time, idle and CPU usage too.

我们还可以使用w命令将当前登录的用户打印到Linux系统中。 此命令还将提供诸如用户的TTY,登录时间,空闲和CPU使用率之类的信息。

$ w
Print Currently Logged In Users
Print Currently Logged In Users
打印当前登录的用户

省略标题(Omit The Header)

While printing currently logged in users we can remove the header part ot the user list. We will use -h option.

在打印当前登录的用户时,我们可以删除用户列表的标题部分。 我们将使用-h选项。

$ w -h
Omit The Header 
Omit The Header
省略标题
LEARN MORE  How to Create New User In CentOS?
了解更多如何在CentOS中创建新用户?

翻译自: https://www.poftut.com/linux-whoami-command-tutorial-find-current-user/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值