In a Linux system, viewing all users of the system is one of the basic operations, so how to view all users of the Linux system? There are two common approaches: the command line and the graphical interface, and the following is a detailed introduction.
1. Use the command line
Use the etc passwd file.
The etc passwd file is a file that stores user account information in the Linux system, and each line represents a user account. We can get all the users in the system by looking at the file.
First, open the terminal and enter the following command:
cat/etc/passwd
This command displays the contents of the etc passwd file, which includes all user account information in the system.
Use the gtent command.
The gtent command can obtain system user and group information, including user account information from the etc passwd file. Enter the following command:
getent passwd
This command will list all user account information in the system.
Use the cut command to combine the etc passwd file.
We can also use the cut command in combination to just output the username column to see all users. Enter the following command:
cut -d: -f1 /etc/passwd
The command will list the usernames of all users in the etc passwd file.
2. Use the graphical interface
Use system administration tools.
In most Linux distributions, system administration tools are provided to manage user accounts. You can see a list of all users in the system by opening the system settings or the management application and finding the user account option.
Use user and group management tools.
Some graphical interface tools, such as user and group management tools, provide the ability to view a list of users. This is a tool that allows you to view existing user accounts.