The whoami command is used to display the username and group of the currently logged in user. Syntax: whoami. Output: Current username. Variants: whoami -u (username only), whoami -g (group only), whoami -p (PID only). Built-in command used to determine the identity of the user when running the command.
whoami command in Linux
What is the whoami command?
The whoami command is a command used to display the username and group of the currently logged in user in a Linux system.
How to use the whoami command?
The syntax of the whoami command is very simple:
<code>whoami</code>
Command output
After executing the whoami command, you will see the following output:
<code>当前用户名</code>
You can also get additional information using the following variations:
Example
The following example shows how to use the whoami command:
<code>$ whoami alice</code>
This means that the current logged in user name is alice.
Additional Information
The above is the detailed content of How to use the whoami command in linux. For more information, please follow other related articles on the PHP Chinese website!