Linux id CommandLinux id command is used to print the genuine and effective user ID and group ID. A user ID (UID) is a particular user identity, whereas group IDs (GIDs) can contain more than one user's identity. This command is a useful tool for user management. Tracing the names of users and groups, and their corresponding UIDs and GIDs is a complex task for the new user. This is important for user management. In such cases, the id command will help us. Syntax: Options: The supported options by the id command are as following:
How to use it?The id command is a built-in utility; therefore, we do not need to install any additional tools to use it. The 'id' command can be used without arguments. Execute the command as follows: From the above command, the output will use the active user. Its default behavior is as follows: From the above output, we can see there are several fields. The first two fields are the UID and GID for the user 'javatpoint'. Whereas, rest are the groups with their respective GID that the 'javatpoint' is a part of. Let's see some other useful examples of the id command. Find a specific user's UIDTo find a user's specific user ID, execute the command with the '-u' option. For example. Find the user Id for the user 'javatpoint', execute the command as follows: Consider the below output: Find a specific user's GIDTo find a specific user's GID, execute the command with the '-g' option. For example, to find the GID for the user 'javatpoint', execute the command as follows: Consider the below output: Display the real GID and UID instead of effectiveWe can display the real UID and GID instead of effective ids by executing the command with the '-r' option. To display the real UID and GID for the user 'javatpoint', execute the following commands: Consider the below output: Display all the different Group IDsTo display all the different GIDs, execute the command with the '-G' option as follows: Consider the below output: Display effective GROUP IDTo display only the effective GID, execute the command with the '-g' option as follows: Consider the below output: Getting HelpIf you get stuck during the use of the id command, you can take help from your terminal. You can read the manual page and help documentation. To take help, execute the below command: The above command will display the help documentation as follows: To read the manual, execute the command as follows: It will display the manual as given below: Next TopicLinux Files |