Linux whoami command-know the current Login User

Source: Internet
Author: User

Generally, you will find that the user name has been displayed at the console command prompt. However, some shells do not display your username by default, such as csh. Therefore, this command should be used on shell terminals that cannot display the user name back.

How to run whoami

To run this command, you only need to enter whoami. In the following example, we use the csh shell terminal.

% Whoami

Whoami Parameter options

This command only has two parameter options:-help and-version.

% Whoamin-help

The following option outputs the same information as the man whoami command.

% Whoami-version

The difference is that-version displays the version information of the whoami command on your system.

Similarity

The whoami command and id-un have the same output. They all display the User Name of the current user.

% Id-un

Conclusion

The whoami command is also used when you use the su command (switch user) to confirm whether the user name for logon is correct. The whoami and who commands are different. The who command displays all the usernames that have been logged on, but the whoami command is not. When you switch users, the whoami command displays the current user to which the session belongs, and the who command displays the source user before the switch.

Ten Linux commands that are rarely known-Part 2

Ten Linux commands that are rarely known-Part 3

11 Linux commands that are rarely known but useful

Linux Command cd

Cat for Linux commands

Linux Command alias/unalias

Linux Command Parsing: su root and su-root

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.