Linux / Unix id Command Examples

Linux / Unix id Command Examples

The id command is a Unix and Linux utility that displays the user and group information for a specified user.

Here is the basic syntax for using the id command:

id [user]
S‮ww:ecruo‬w.lautturi.com

The user argument is optional. If you do not specify a user, id will display the user and group information for the current user. If you specify a user, id will display the user and group information for that user.

For example, to display the user and group information for the current user, you can use the following command:

id

This will display the user ID (UID), group ID (GID), and group membership for the current user.

For example, if the current user is a member of the users and admins groups, the command will output:

uid=1000(user) gid=1000(user) groups=1000(user),100(admins)

To display the user and group information for a different user, you can specify the username as an argument.

For example, to display the user and group information for the user john, you can use the following command:

id john

This will display the user ID (UID), group ID (GID), and group membership for the user john.

You can use the -u option to display only the user ID (UID) and the -g option to display only the group ID (GID).

For example:

id -u john
id -g john

These commands will display the user ID (UID) and group ID (GID) for the user john, respectively.

Created Time:2017-10-29 22:08:58  Author:lautturi