List all Linux users without systen users

2019-08-01 02:13发布

I would like to list all users in Linux without showing systen-user. How can I make this only the username .

For example cut -d: -f1 /etc/passwd, I can see all users + system users.

2条回答
老娘就宠你
2楼-- · 2019-08-01 03:18

This shows all users with uid less than 999:

awk  -F':' '$3>999 {print $1 " uid: " $3}' /etc/passwd | column -t | grep -v nobody

EDIT:

With cut showing only human users:

cut -d: -f1,3 /etc/passwd | egrep ':[0-9]{4}$' | cut -d: -f1
查看更多
孤傲高冷的网名
3楼-- · 2019-08-01 03:18

You can try this : awk -F: '$6 ~ /\/home/ {print}' /etc/passwd

查看更多
登录 后发表回答