翻译完成

This commit is contained in:
runningwater 2013-12-18 20:51:54 +08:00
parent a529b77fc9
commit 7d01404a01
2 changed files with 49 additions and 50 deletions

View File

@ -1,50 +0,0 @@
(翻译中 by runningwater)
Linux whoami command Knowing Who is Logged In
================================================================================
Generally, on your console you will find a **username is printed** on the command prompt. But in some shell such as **csh**, by default you will not see your username there. So this command particularly is used with the shell which dont print the username on their shell.
### How do I run whoami ###
To run this command, just type whoami. For this sample we are using chs shell.
% whoami
![](http://linoxide.com/wp-content/uploads/2013/12/csh.png)
### Whoami options ###
This command only have two options. **help** and **version**.
% whoamin help
![](http://linoxide.com/wp-content/uploads/2013/12/whoami_help.png)
This options will output the same information with **man whoami**
% whoami version
![](http://linoxide.com/wp-content/uploads/2013/12/whoami_version.png)
While **version** will show you the version of whoami in your system
### Similarity ###
Whoami command has the same output with command **id -un**. It also print the username of current user.
% id -un
![](http://linoxide.com/wp-content/uploads/2013/12/id-un.png)
### Conclusion ###
Whoami command is also used when you are doing su activity (switch user). This command can confirm you that you are logged in using a correct user. Whoami is different with who command. Who command display all logged in user while whoami not. When you are switching user, whoami will reports the current user which the owner of the session, while who command will report you the original user before you are switching user.
![](http://linoxide.com/wp-content/uploads/2013/12/whoami_vs_who.png)
--------------------------------------------------------------------------------
via: http://linoxide.com/linux-command/linux-whoami-command/
译者:[runningwater](https://github.com/runningwater) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -0,0 +1,49 @@
Linux系统 whoami 命令 知晓当前登陆用户
================================================================================
通常,在控制台的命令提示符下你会发现 **用户名已经被显示出来** 。但有一些 shell, 比如 **csh**, 默认情况下是不会显示你的用户名的。所以这个命令最应该用在那些不能回显用户名的 shell 终端上。
### 怎么样使用 whoami ###
要使用这个命令,仅仅只需要输入 whoami 。下面的例子中我们使用的是 chs shell 终端。
% whoami
![](http://linoxide.com/wp-content/uploads/2013/12/csh.png)
### Whoami 的参数选项 ###
这个命令仅仅只有两个参数选项: **help** 和 **version**。
% whoamin help
![](http://linoxide.com/wp-content/uploads/2013/12/whoami_help.png)
下面这选项会输出和 **man whoami** 命令一样的信息
% whoami version
![](http://linoxide.com/wp-content/uploads/2013/12/whoami_version.png)
不同的是 **version** 会显示你系统上的 whoami 命令的版本信息
### 相似性 ###
whoami 命令和 **id -un** 有相同的输出。它们都打印出当前用户的用户名。
% id -un
![](http://linoxide.com/wp-content/uploads/2013/12/id-un.png)
### 结论 ###
whoami 命令也用于当你使用 su 命令(切换用户)时, 它能让你确认出你登陆的用户是否正确。 whoami 跟 who 命令不相同, who 命令会显示所有已经登陆的用户名,而 whoami 不是。当你切换用户时, whoami 命令会显示会话所属的当前用户,而 who 命令会显示你切换前的那个源用户。
![](http://linoxide.com/wp-content/uploads/2013/12/whoami_vs_who.png)
--------------------------------------------------------------------------------
via: http://linoxide.com/linux-command/linux-whoami-command/
译者:[runningwater](https://github.com/runningwater) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出