How to list users in Linux?

Table of contents:

How to list users in Linux?
How to list users in Linux?
Anonim

One of the features of multi-user operating systems, which includes Linux, is the ability to use it by different people. Usually, a separate account is created for each of them. On Linux, the list of users can be viewed using the command interpreter by typing a special character sequence. This solution to the problem is the simplest and does not require the use of special skills.

linux user list
linux user list

Who is considered a user of the system

Any person who uses a computer and OS facilities can be considered a user. It is assigned a certain unique name (no other name is allowed), which may include Latin letters, Arabic numbers, symbols "_" and ".". Each user has a separate directory. He gets into it after authorization. It contains a number of personal files and folders. Typically, user directories are located in the /home directory. The OS administrator can set up accounts to restrict access to files, directories, and peripherals.

How to list users in Linux

How to solve the problem of displaying existing accounts? On a Linux system, a list of usersoutput by the command (various parameters are allowed):

cat /etc/passwd

Why does it work? The fact is that all the necessary data is contained in the /etc/passwd file. A person who is interested in accounts addresses him directly. After the command is given, a list of Linux accounts is displayed. The list of users in the system can be quite extensive. Data about existing accounts is displayed line by line.

How might this look on the screen? Each line will be something like this:

root:xD634Jhs5jH32:0:0:root:/root:/bin/bashnewuser:Xv7Q641g89oKK:1000:100:Ivan Fedorov:/home/newuser:/bin/bash

linux list of users in the system
linux list of users in the system

Decryption:

account (username):password (password stored in encrypted form):UID (unique ID):GID (user's main group ID):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 need to display a list of users in Linux who are active right now? To do this, you can use the following command:

who

By typing this instruction, a person will be able to view the list of active accounts in the system. In this case, on Linux, the list of users is also done line by line. With administrator rights, 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.

Popular topic

Editor's choice