Originally published at: https://www.cyberciti.biz/faq/linux-list-all-members-of-a-group/
I am 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?
Hi, check out this simple pretty print script for all users and groups I just wrote based on an article from this site, by Vivek:
That is cool indeed. Maybe run it via shell linter too. It gave some warnings:
In list_users.sh line 13:
Red="\033[0;31m" # Red
^-- SC2034: Red appears unused. Verify it or export it.
In list_users.sh line 20:
echo -e "$Bar${Bold}[ System User Groups ]${ResetTxt}$Bar"
^-- SC2039: In POSIX sh, echo flags are undefined.
^-- SC2154: Bold is referenced but not assigned.
In list_users.sh line 28:
echo -e "$Bar${Bold}[ System User Accounts ]${ResetTxt}$Bar"
^-- SC2039: In POSIX sh, echo flags are undefined.
Thanks Vivek, I had copied it with some minor bugs. I used your suggestion to check it with the lint checker, used shellcheck.net but in vs code, and fixed the echo statements, etc. The code is now updated. Added screenshot too.
I couldn’t add it to https://www.cyberciti.biz/faq/linux-list-users-command/ there’s no link to post
Awesome. Don’t worry it will show under comment when cache expired in few days.