Groups Command in Linux With Examples Last Updated : 11 Sep, 2024 Comments Improve Suggest changes Like Article Like Report In Linux, there can be multiple users (those who use/operate the system), and groups are nothing but a collection of users. Groups make it easy to manage users with the same security and access privileges. A user can be part of different groups. The 'groups' command is a powerful tool that allows administrators to view the group memberships of a user and retrieve information about user groups on a Linux System.Features of the 'groups' CommandGroups command prints the names of the primary and any supplementary groups for each given username, or the current process if no names are given.If more than one name is given, the name of each user is printed before the list of that user’s groups and the username is separated from the group list by a colon.Syntaxgroups [options] [username]Key Options of the`groups`command1. `--help`It provides information about the command's usage and how to specify the username and the functionality of the command.groups --help2. `--version`It will display the version of the `groups` command.groups --versiongroups --versionExamples and Implementation of `groups` command in LinuxHere are some common ways to use the 'groups' command to view user group memberships:1. Viewing Group MembershipsTo view the group memberships of a user is the most common usage of the `groups` command.Syntax:groups [username]Example: Viewing the groups of a user named demon:groups demongroups demonIn this example, username 'demon' is passed with the groups command and the output shows the groups in which the user demon is present, separated by a colon. 2. To display group membership for the current userNo username is passed then this will display group membership for the current user.groupsgroups Here the current user is a demon. So, when we give "groups" command we only get groups in which 'demon' is a user.3. Passing 'root' with groups commandIt displays the group memberships for the user account "root"groups rootgroups rootNote: Primary and supplementary groups for a process are normally inherited from its parent and are usually unchanged since login. This means that if you change the group database after logging in, groups will not reflect your changes within your existing login session. ConclusionIn this article we have discussed `groups` command, which is used to view the group memberships of users. It also displays the primary and supplementary groups. We see that it has two options `--help` and `--version` which provide additional information and version details respectively. Comment More infoAdvertise with us S schrodinger_19 Follow Improve Article Tags : Technical Scripter Linux-Unix Technical Scripter 2018 Similar Reads Fun Commands in Linux Linux isn't just for coding and administrationâit can also be a lot of fun. With a variety of terminal commands, you can add some entertainment to your Linux experience. Below is a list of some cool and fun commands you can use in Linux to enhance your terminal experience. Weâll also cover how to in 3 min read function command in Linux with examples The function is a command in Linux that is used to create functions or methods. It is used to perform a specific task or a set of instructions. It allows users to create shortcuts for lengthy tasks making the command-line experience more efficient and convenient. The function can be created in the u 2 min read Compiling with g++ g++ command is a GNU c++ compiler invocation command, which is used for preprocessing, compilation, assembly and linking of source code to generate an executable file. The different "options" of g++ command allow us to stop this process at the intermediate stage.  Check g++ compiler version informa 3 min read gawk command in Linux with Examples The gawk command in Linux is a pattern scanning and processing language. No compilation is required, and variables can be used along with numeric functions, string functions, and logical operators. Gawk is a utility that enables programmers to write highly compact but still effective programs as sta 3 min read gcc command in Linux with examples GCC stands for GNU Compiler Collections which is used to compile mainly C and C++ language. It can also be used to compile Objective C and Objective C++. The most important option required while compiling a source code file is the name of the source program, rest every argument is optional like a wa 2 min read gdb command in Linux with examples GDB, the acronym for GNU Debugger, is a powerful debugging tool used to analyze and debug programs written in languages like C, C++, Ada, and Fortran. It allows developers to inspect the behavior of their programs, step through code, set breakpoints, and examine variable values in real-time. GDB is 8 min read getent command in Linux with examples The 'getent' command in Linux is a powerful tool that allows users to access entries from various important text files or databases managed by the Name Service Switch (NSS) library. This command is widely used for retrieving user and group information, among other data, stored in databases such as ' 5 min read gpasswd Command in Linux with examples gpasswd command is used to administer the /etc/group and /etc/gshadow. As every group in Linux has administrators, members, and a password. It is an inherent security problem as more than one person is permitted to know the password. However, groups can perform co-operation between different users. 4 min read grep command in Unix/Linux The grep command in Unix/Linux is a powerful tool used for searching and manipulating text patterns within files. Its name is derived from the ed (editor) command g/re/p (globally search for a regular expression and print matching lines), which reflects its core functionality. grep is widely used by 7 min read How to Create a new group in Linux | groupadd command In the Linux operating system, user management is a crucial aspect of system administration. One of the fundamental tasks is creating and managing user groups. Groups in Linux allow administrators to organize and control user access to various resources and files. The groupadd command is a powerful 7 min read Like