List all Linux users without systen users

回眸只為那壹抹淺笑 提交于 2019-12-11 07:28:54

问题


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.


回答1:


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



回答2:


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



来源:https://stackoverflow.com/questions/39482163/list-all-linux-users-without-systen-users

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!