Article Title: how to view users and user groups in linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Whois
Function Description: search for and display user information.
Method: whois [Account name]
Note: The whois command will search for and display the user information of the specified account, because it is found in the WHOIS database of Network Solutions, so the account name must be registered above for retrieval, the name is case-insensitive.
---------------------------------------------------------
Whoami
Function Description: The user name is displayed first.
Syntax: whoami [-- help] [-- version]
Note: The user name is displayed. This command is equivalent to executing the "id-un" command.
Parameters:
-- Help Online help.
-- Version: displays the version information.
---------------------------------------------------
Who
Function Description: displays the user information currently logged on to the system.
Syntax: who [-Himqsw] [-- help] [-- version] [am I] [record files]
Note: If you execute this command, you will find that there are users logging on to the system. The terminals used to log on to the account will be listed when you execute the who command separately, the logon time and where to log in or which X monitor is being used.
Parameters:
-H or -- heading displays the title information columns of each column.
-I or-u or -- idle indicates the idle time. If the user performs any action within the previous minute, it indicates ". ", if the user has not performed any action for more than 24 hours, the" old "string is displayed.
-M this parameter has the same effect as the specified "am I" string.
-Q or -- count only displays the name and total number of accounts logged on to the system.
-S this parameter will be ignored and will not be processed. It is only responsible for solving compatibility issues with other versions of the who command.
-W or-T or -- mesg or -- message or -- writable displays the user information status bar.
-- Help Online help.
-- Version: displays the version information.
----------------------------------------------------
W
Function Description: displays the user information currently logged on to the system.
Syntax: w [-fhlsuV] [user name]
Note: If you execute this command, you can find out who are currently logged on to the system and the programs they are executing. Run w
The command displays all users. You can also specify a user name to display only information about a user.
Parameters:
-F. enable or disable the function to show where the user logs on to the system.
-H: The title information column of each column is not displayed.
-L use the detailed format list, which is the default value.
-S uses a concise format list, which does not display the User Logon Time, CPU time consumed by terminal jobs and programs.
-U ignores the name of the execution program and the CPU time consumed by the program.
-V displays the version information.
-----------------------------------------------------
Finger command
The finger command is used to query user information. It usually displays the user name, main directory, stagnation time, Logon Time, logon shell, and other information of a user in the system. To query user information on a remote machine, you need to connect the user name to "@ host name" in the format of [user name @ host name]. However, the network host to be queried must run the finger daemon.
The common format of this command is:
Finger [Option] [user] [user @ host]
The meanings of the options in the command are as follows:
-S displays the user's registration name, actual name, terminal name, write status, stagnation time, Logon Time, and other information.
-L in addition to the information displayed with the-s option, it also displays information such as the user's home directory, logon shell, email status, and under the user's home directory. plan ,. project and. the content of the forward file.
-P is the same as the-l option except that the. plan and. project files are not displayed.
[Example] Run the finger command on the local machine.
$ Finger xxq
Login: xxq Name:
Directory:/home/xxq Shell:/bin/bash
Last login Thu Jan 1 21:43 (CST) on tty1
No mail.
No Plan.
$ Finger
Login Name Tty Idle Login Time Office Phone
Root * 1 28 Nov 25
......
------------------------------------------------------------------
The/etc/group file contains all groups.
All usernames in the/etc/shadow and/etc/passwd Systems
Method for modifying the group to which the current user belongs
Usermod or you can directly modify the/etc/paaawd file.
----------------------------------------------------------------
[1] [2] Next page