Home > Article > Operation and Maintenance > How to view all users under linux
The way to view all users under Linux is to view the /etc/passwd file. The /etc/passwd file contains basic information for each user. When we create a new user in the system, the new user's detailed information will be added to this file.
#User information in the Linux system is stored in the /etc/passwd file.
(Recommended learning: linux tutorial)
This is a text file containing basic information for each user. When we create a user in the system, the details of the new user are added to this file.
Use any file operation command such as cat, more, less, etc. to print the user list created on the Linux system.
/etc/passwd is a text file that contains the information for each user necessary to log in to the Linux system. It saves user's useful information such as username, password, user ID, group ID, user ID information, user's home directory and shell. The
/etc/passwd file writes each user's details as one line, containing seven fields, each separated by a colon:.
The command is as follows:
# cat /etc/passwd root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin adm:x:3:4:adm:/var/adm:/sbin/nologin lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin sync:x:5:0:sync:/sbin:/bin/sync shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown halt:x:7:0:halt:/sbin:/sbin/halt mail:x:8:12:mail:/var/spool/mail:/sbin/nologin ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin postfix:x:89:89::/var/spool/postfix:/sbin/nologin sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin tcpdump:x:72:72::/:/sbin/nologin 2gadmin:x:500:10::/home/viadmin:/bin/bash apache:x:48:48:Apache:/var/www:/sbin/nologin zabbix:x:498:499:Zabbix Monitoring System:/var/lib/zabbix:/sbin/nologin mysql:x:497:502::/home/mysql:/bin/bash zend:x:502:503::/u01/zend/zend/gui/lighttpd:/sbin/nologin rpc:x:32:32:Rpcbind Daemon:/var/cache/rpcbind:/sbin/nologin 2daygeek:x:503:504::/home/2daygeek:/bin/bash named:x:25:25:Named:/var/named:/sbin/nologin mageshm:x:506:507:2g Admin - Magesh M:/home/mageshm:/bin/bash
The above is the detailed content of How to view all users under linux. For more information, please follow other related articles on the PHP Chinese website!