How to make an user list
- カテゴリ:
- Linux
All users are listed in a file /etc/passwd.
$ 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
With a command awk, you could get the first field easily.
$ awk -F':' '{ print $1 }' /etc/passwd | sort
adm
apache
bin
コメント