Maud  Rosenbaum

Maud Rosenbaum


Linux Show All Members of a Group Command - nixCraft

Iam a new Linux user and created a couple of groups on the server. I need to find out all members of a group called “ftponly”. How do I list all members of a group on Linux or Unix-like systems?

The /etc/group  file is a text file that defines the groups on the Linux and Unix based systems. You can simply query this file to find and list all members of a group.


Linux Show All Members of a Group Commands

  1. /etc/group file – User group file
  2. members command – List members of a group
  3. lid command (or libuser-lid on newer Linux distros) – List user’s groups or group’s users

There are two types of groups in Linux:

  • Primary group – is the main group that is associated with user account. Each user is a member of exactly one primary group.
  • Secondary group – used to provide additional rights to user. For example, access to the dvd/cdrom drive can be granted with help of cdrom group.

Linux: List all members of a group using /etc/group file

Use the grep command as follows:

$ grep 'grpup-name-here' /etc/group

$ grep 'ftponly' /etc/group

$ grep -i --color 'ftponly' /etc/group


To get just a list of all members of a group called ftponly, type the following awk command:

awk -F':' '/ftponly/{print $4}' /etc/group
## list all members of sudo group in linux #
awk -F':' '/sudo/{print $4}' /etc/group

Display group memberships for each Linux user

Want to see group memberships for each given USERNAME under Linux? The syntax is as follows for the groups command:


groups {USERNAME}

groups vivek

The following outputs indicates that the user named ‘vivek’ is part of four groups including ‘vivek’ primary group:

vivek : vivek wheel lxd vboxusers

Linux List all members of a group using members command

Warning: members command is not installed on most Linux distros. Use yum command or apt-get command/apt command to install the same:

sudo apt-get install members

To outputs members of a group called ftponly, enter:

$ members {GROUPNAME}

$ members ftponly

Fig. 01: members command in action on Linux show all members of a group commandFig. 01: members command in action to list members in a group

In this example the members command  displays a space-separated list of group member names on screen.How to list all users in a Linux group using lid command

You can displays information about groups containing user name, or users contained in group name using lid command as follows.

Warning: lid command is not installed on most distros. Use yum command or apt-get command to install the same:

sudo apt-get install libuser


What is GEEK

Buddha Community

Linux Show All Members of a Group Command - nixCraft

Examples of the dig command in Linux

Dig Command Line Options and Examples
Here is the frequently used command line options and example’s of dig command.
1. Basic Dig Command
A basic dig command accept domain name as command line parameter and prints Address record.
2. Query With Specific DNS Server
The default dig command queries to dns server configured on your system. For example, the Linux systems keep default DNS entry in /etc/resolv.conf.
3. Print Short Answer
Use +short command line option to print result in short form. This is basically useful with the shell scripting and other automation tasks.
4. Print Detailed but Specific Result
Use +noall with +answer to print detailed information but specific. This will print only answer section including few more details as a result.

#linux commands #command #dig #dig command #useful examples #linux

Useful Example for the mv command in Linux

mv Command Examples
Below is the basic mv command examples on Linux terminal.

  • Rename file in current directory – For example rename file source.txt to dest.txt in current directory.
  • Move file to destination directory – Move a source.txt file available in current directory to /tmp directory. In above command the file name is unchanged at target directory. You can also rename file name at destination directory just by providing filename at destination.
  • Move file from source directory to destination directory – We can also move files or directory from some other directory to destination directory.
  • Move multiple files to destination at once – The mv accepts multiple source files and move them to the destination directory at once. The following command will move file1.txt, file2.txt in current directory and /opt/file3.txt to the /tmp directory. Here the last command line parameter is used as destination by the mv command.

#linux commands #command #mv #useful example #mv command #linux

date command in Linux with Examples

date Command Examples
Show date time in UTC/GMT
View past dates on specific days
View future dates
View date in other timezone
Print date in specific format
View file modification time

#linux commands #command #date #linux

20 Funny Commands of Linux or Linux is Fun in Terminal

1. Command: sl (Steam Locomotive)

2. Command: telnet

3. Command: fortune

4. Command: rev (Reverse)

5. Command: factor

6. Command: script

7. Command: Cowsay

8. Command: yes

9. Command: toilet

10. Command: cmatrix

#linux commands #terminal #funny commands #linux

I am Developer


How to Delete Directories and Files in Linux using Command Line

In this remove or delete directories and files linux tutorial guide, you will learn how to remove empty directory and non empty directory linux using command line. And as well as how to remove/file files linux using command line.

If you work with Linux then you will need the following:

  • how to remove empty directory in linux,
  • how to remove non empty directory,
  • how to remove directory without confirmation linux
  • how to remove files with and without confirmation in linux.

So, this tutorial guide will show you you how to use the rmunlink, and rmdir commands to remove or delete files and directories in Linux with and without confirmation.

#how to delete directory in linux #how to remove non empty directory in linux #remove all files in a directory linux #linux delete all files in current directory #linux delete all files in a directory recursively #delete all files in a directory linux