Skip to content

Commit

Permalink
TIL: Linux Groups
Browse files Browse the repository at this point in the history
  • Loading branch information
Aidan Casey committed Dec 11, 2018
1 parent 46cae0b commit 371cc07
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
# Today-I-Learned
Based on https://github.com/mborn319/today-i-learned and https://github.com/jbranchaud/til.
# Today I Learned

Things I have learned over time, a reference for me and any who may stumble across this repository.

## Categories

* [Linux](#linux)

## Linux

* [Get a full list of Groups](linux/get-a-full-list-of-groups.md)
* [List all members of a Group](linux/list-all-members-of-a-group.md)
9 changes: 9 additions & 0 deletions linux/get-a-full-list-of-groups.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Get a full list of Groups

For an entire group list, use the following.

```bash
cut -d: -f1 /etc/group | sort
```

[Found on StackOverflow](https://stackoverflow.com/questions/14059916/is-there-a-command-to-list-all-unix-group-names)
21 changes: 21 additions & 0 deletions linux/list-all-members-of-a-group.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# List all members of a Group

## To list members of a group

```bash
grep '{{groupName}}' /etc/group
```

## To add some color

```bash
grep -i --color '{{groupName}}' /etc/group
```

## To list only member names of a group

```bash
awk -F':' '/{{groupName}}/{print $4}' /etc/group
```

[Found on CyberCiti](https://www.cyberciti.biz/faq/linux-list-all-members-of-a-group/)

0 comments on commit 371cc07

Please sign in to comment.