-
id – Print user identity in Linux
Posted on October 12th, 2008 No commentsIn Linux, each user has got access rights. And each user can be / is assigned to multiple groups depending upon the powers that need to be assigned to the user. Is there is an easy way to find the groups that a user belongs to ? Yes you can using the ‘
id‘ command.The
idcommand lists not just the groups the user belongs to but also his or her user ID and group ID. To find the groups that are assigned to the root account, log in as root and type theidcommand in the terminal. On my machine, I received the following output, though you may receive a different output depending upon the Linux distribution you are using.# id uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),19(log)
From the above output, we can see that root has UID and GID of zero and is a member of the following groups namely – bin, daemon, sys, adm, disk, wheel and log, apart from root group itself.
To know the user ID and groups of a different user, log in as root and execute the
idcommand passing it the username of the user.You can also use the
idcommand from an ordinary user account to find the groups you belong to.Related Posts
- How to print a man page from the command line in Linux
- How to find large files in Linux using command line
- Print files with line numbers for each line in Linux
- pwd – Linux Command to Print Working Directory
- lshw command – List hardware information in Linux
