Home>Article>Operation and Maintenance> What is the method to view all users in linux
We can view all users under Linux by viewing the /etc/passwd file.
Use any file operation command like 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 specific command is:
# 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
Recommended tutorial:linux tutorial
The above is the detailed content of What is the method to view all users in linux. For more information, please follow other related articles on the PHP Chinese website!