linux Check which users are in the system
All user information in the Linux system is stored in the /etc/passwd file , we can view the user by printing
cat /etc/passwd
. Each line represents one user. The last field of each line is the user's shell execution environment. Nologin means that the system cannot be logged in.
View users who can log in to the system
cat /etc/passwd | grep -v "nologin"
View the total number of system users:
cat /etc/passwd | wc -l
will return the total number of users.
View current users:
whoami
View current system online users:
w
Recommended: [Linux video tutorial】
The above is the detailed content of Linux checks which users are on the system. For more information, please follow other related articles on the PHP Chinese website!