Users
The getent command
Queries the system databases (users, groups, hosts). It is the right way to check whether an account or group exists.
Syntax
getent passwd|group|hosts [nombre]Copy-ready examples
$ getent passwd alumnoCheck a user$ getent group sudoCheck a groupYou can try them in the browser terminal: it does not touch your computer.
Typical mistakes
- Unlike reading /etc/passwd by hand, getent also includes network users (LDAP, etc.).
FAQ
Why is it better than grep /etc/passwd?
Because it queries every system source, not only the local file.
Learn to actually use it
The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.
Start the free course