Skip to content

Instantly share code, notes, and snippets.

@carlashley
Created November 25, 2016 10:47
Show Gist options
  • Save carlashley/65c05b91fa8923b6138018819745e212 to your computer and use it in GitHub Desktop.
Save carlashley/65c05b91fa8923b6138018819745e212 to your computer and use it in GitHub Desktop.
List all local users and exclude system accounts and dump out as CSV
#!/bin/sh
# This will also work with /Search/Users instead of /Local/Users
/usr/bin/dscl localhost -list /Local/Users UniqueID | awk '$2 >= 100 { print $1 "," }' | grep -v "^_" > users.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment