How do I find out the group name under Linux operating systems using bash shell prompt? How do I display group information for the specified USERNAME under Linux?
Open a command-line terminal (select Applications > Accessories > Terminal), and then type the following command to list your group ownership i.e. display the groups a user is in:
$ users
Sample outputs:
vivek adm dialout cdrom plugdev lpadmin netdev admin sambashare libvirtd
vivek user is part of the above groups. To display group memberships for a user called tom, enter:
$ users userName
$ users tom
To print the primary group membership for a user called tom, enter:
$ id -g -n tom
To print the secondary group membership for a user called tom, enter:
$ id -G -n tom
You can also search /etc/group file as follows using the grep command:
$ grep Username /etc/group
$ grep vivek /etc/group
Sample outputs:
adm:x:4:vivek dialout:x:20:vivek cdrom:x:24:vivek plugdev:x:46:vivek lpadmin:x:105:vivek netdev:x:112:vivek admin:x:119:vivek vivek:x:1000: sambashare:x:122:vivek libvirtd:x:125:vivek
See also:
If you need assistance with Linux groups membership related commands, turn to the man page first. It will give you detailed information, parameters and switches for the following commands:
$ man id
$ man groups
$ man 5 group
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop











![Linux: Change the PATH [ Add New Directory ]](http://s13.cyberciti.org/images/shared/rp/3/0.jpg)

{ 1 comment… read it below or add one }
$ grep vivek /etc/group
->
$ getent group vivek
$ grep vivek /etc/passwd
->
$ getent passwd vivek