Skip to the content.

Check If A User Exists

We can check if a user exists on Linux System by id command.

id - print real and effective user and group IDs


$ id -u jungle

If a user does not exists on system, it throws an error. For example -

$ id -u unknown
id: ‘unknown’: no such user

Source: StackOverFlow