getent groups
output looks like this:
rontab:x:102: syslog:x:103: fuse:x:104: mlocate:x:105: ssh:x:106: netdev:x:107: landscape:x:108: user:x:1000: lpadmin:x:109:user sambashare:x:110:user admin:x:111:user ssl-cert:x:112: Controlling:*:11002: dignum Project Center:*:11003: dignum Service Center:*:11004: Finance:*:11005: General:*:11007: Human Resources:*:11008: Legal:*:11009: Logistics:*:11010: Management:*:11011: Marketing:*:11012: Partner Management:*:11002: Monitoring:*:11014: Purchasing:*:11015: Sales:*:11016: Security:*:11018: Teamdrive:*:11019:
Bash command that turns the last 18 group names into a folder:
getent group | tail -n 18 | cut -f1 -d ":" | xargs -i mkdir {} # Other stuff getent group | tail -n 18 | cut -f1 -d ":" | xargs -i mkdir /home/Groups/{} getent passwd | tail -n 5 | cut -f1 -d ":" | xargs -i mkdir -p /home/{}/Shared/Groups/ ls /home/Groups/ | xargs -i chgrp {} /home/Groups/{}/