One of the features of multi-user operating systems, which include Linux, is the ability to be used by different people. Usually, a separate account is created for each of them. In Linux, the list of users can be viewed using the shell by entering a special sequence of characters. This solution to the problem is the simplest and does not require the use of special skills.
Who should be considered a system user
Any person who uses a computer and OS tools can be considered a user. He is assigned a specific unique name (otherwise not allowed), which may include Latin letters, Arabic numbers, the symbols "_" and ".". Any user has a separate directory. He gets into it after authorization. It contains a number of personal files and folders. Usually user directories are located in the / home directory. The OS administrator can set up accounts to differentiate access to files, directories, and peripherals.
How to list users on Linux
How to solve the problem of withdrawing existing accounts? On Linux, the list of users is displayed by the command (it is allowed to use various parameters):
# cat / etc / passwd
Why does it work? The fact is that the file / etc / passwd contains all the necessary data. The person who is interested in the accounts addresses directly to him. After setting the command, a list of Linux accounts is displayed. The list of users in the system can be quite extensive. Information about existing accounts is displayed line by line.
How can it look on the screen? Each line will be something like the following:
root: xD634Jhs5jH32: 0: 0: root: / root: / bin / bashnewuser: Xv7Q641g89oKK: 1000: 100: Ivan Fedorov: / home / newuser: / bin / bash
Decoding:
account (user name): password (password stored in encrypted form): UID (unique ID ): GID (ID of the main user group): GECOS (additional information): directory (user directory): shell (used command interpreter).
How to view active accounts
The above command allows you to display a list of all users registered in the system. But what if you want to list Linux who are active right now? To do this, use the following command:
# who
By typing this instruction, a person will be able to view a list of active accounts in the system. In this case, on Linux, the user list also performed line by line. With administrator privileges, you can perform various manipulations with active accounts. So, you can give people access to certain files or folders, restrict the use of certain programs.