who, w, who am i, whoami command id and end user can view the current.
Id command syntax
id [OPTION]... [USER]
id [-gGnru][--help][--version][USER]
Parameter options | explain |
-g or --group | Displaying a user belongs to the group's ID. |
-G or --groups | Additional display belongs to a group of user ID. |
-n or --name | Display name of the user, their group or additional groups. |
-r or --real | Show the actual ID. |
-u some --user | Displays the user ID. |
-help | Displays help. |
-version | Displays version information. |
Example 1: no arguments, ask the current user default
[root@XX ~]# id uid=0(root) gid=0(root) groups=0(root)
Example 2: shows a specified user's UID
[root@XX ~]# id -u root 0
Example 3: Display information of the specified user
[root@XX ~]# id user uid=1005(user) gid=1005(user) groups=1005(user)
W command syntax
w
Users log in to display the currently running processes and their
[root@XX ~]# w 23:05:06 up 4:52, 2 users, load average: 0.00, 0.01, 0.05 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT root :0 :0 Thu23 ?xdm? 1:35 0.38s /usr/libexec/gn root pts/0 :0 02:59 2.00s 0.05s 0.00s w
The default output of the same content with the first line of the command output command uptime w. USER: login account username, TTY: tty names, FROM: Which hosts from the login, LOGIN @: login time, IDLE: idle time, JCPU: CPU time all processes on the tty used, PCPU: current process CPU time used, WHAT: processes that are currently running.
Who command syntax
who - [husfV] [USER]
who and w commands similar to, but more powerful
Parameter options | explain |
--help | Online help. |
-H or --heading | Column displays the title information for each field. |
-i or -u or --idle | Idle time display, if the first user has one minute no action, as the mark. "" No, if the user has more than 24 hours without any action, then mark the "old" string. |
-m | And the effect of this parameter designated "am i" the same character string. |
-s | This argument ignores not be processed, only who is responsible for resolving compatibility issues with other versions of the directive. |
-T or -w or --mesg or --message or --writable | The status bar displays the user's information. |
-q or --count | Show only login account name and the total number of systems. |
Example 1: no parameter
[root@XX ~]# who
root :0 2019-11-07 23:12 (:0)
root pts/0 2019-11-08 02:59 (:0)
The syntax of the command who am i
who am i
Example 1: Displays the current user terminal and a sign start time
[root@XX ~]# who am i root pts/0 2019-11-08 02:59 (:0)
Whoami command syntax
whoami
Example 1: Displays the current user
[root@XX ~]# whoami root