Top community members
All Wiki Articles Create Wiki Article

Welcome to Dirask IT community! ❀ đŸ’»
We are community of people that helps each other.

If you think you have some skills to help others

help someone and become a part of our community - List Q & A

Linux - list available groups

0 contributions
3 points

In this article, we're going to have a look at how to get information about available groups in Linux.

Groups in Linux are located in /etc/group file.

Quick overview:

cat /etc/group | cut -d : -f 1

Look on below practical examples:

1. List group names example

In this section we used cat and cut commands to extract group names. cat command reads file content and cut command cuts specific data from each row. As delimiter for cut we used : (-d :) getting only first field (-f 1).

cat /etc/group | cut -d : -f 1

Part of example output:

root
daemon
bin
sys
adm
tty
disk
...

2. List all groups data example

In this section we want to show how list all group file content with cat command.

cat /etc/group

Part of example output:

root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:syslog,marcin
tty:x:5:
disk:x:6:
...

 

0 contributions

Checkout latest Findings & News:

Checkout latest questions:

Checkout latest wiki articles:

Hey 👋
Would you like to know what we do?
  • Dirask is IT community, where we share coding knowledge and help each other to solve coding problems.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.
Read more