Logo

Is there a command to list all Unix group names?

You can list all Unix group names by reading the /etc/group file and extracting the first field (group name) of each line. A simple way is:

cut -d: -f1 /etc/group
  • -d: sets the field delimiter to a colon (:).
  • -f1 specifies that you only want the first field (the group name).

If you’re using a system that integrates with NIS or LDAP for group information, this command might not show network-based groups; you’d need to query those systems separately. However, for local groups, this is sufficient.

Recommended Resource
To strengthen your Unix/Linux skills alongside core coding knowledge, you may find this course from DesignGurus.io helpful:

CONTRIBUTOR
TechGrind