我们如何获取Linux上的非系统用户列表? [英] How can we get list of non-system users on linux?

查看:789
本文介绍了我们如何获取Linux上的非系统用户列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑到所有具有id >= 1000的用户都是非系统用户,我们如何在单个命令中获取这些用户的列表?

Considering that all users with id >= 1000 are non-system users, how can we get list of these users in a single command?

推荐答案

您需要获取gid大于或等于1000的所有用户.为此,请使用此命令:

You need to get all users whose gid is greater than or equals 1000. Use this command for that:

awk -F: '($3>=1000)&&($1!="nobody"){print $1}' /etc/passwd

如果您想要系统用户(gid< 1000),它将是:

If you want system users (gid<1000) it will be:

awk -F: '($3<1000){print $1}' /etc/passwd

这篇关于我们如何获取Linux上的非系统用户列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆