A service of Daily Data, Inc.
Contact Form

User Tools

Site Tools


quickreference:unix

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

quickreference:unix [2025/02/05 00:12] – created - external edit 127.0.0.1quickreference:unix [2026/05/27 01:33] (current) rodolico
Line 4: Line 4:
  
 ===== Systems Administration ===== ===== Systems Administration =====
 +
 +==== Get list of all non-system Users ====
 +
 +I needed a quick 'one liner' to get all non-system users on a Unix system. In this case, non-system was defined as having a UID >= 1000 (common practice) or a shell. The first line defines this.
 +
 +This command can be copied and pasted into a terminal as a standard user, and will result in a tab separated list of the user, home directory, shell, and a comma separated list of group memberships
 +
 +<code bash>
 +getent passwd | awk -F: '($3>=1000)||($7~/(\/bash|\/sh|\/zsh|\/ksh|\/fish|\/tcsh)$/){print $1":"$6":"$7}' \
 +| while IFS=: read user home shell; do groups=$(id -nG "$user" 2>/dev/null | tr ' ' ','); printf "%-20s %-30s %-20s %s\n" "$user" "$home" "$shell" "$groups"; done
 +</code>
  
 ==== Partitioning large drives ==== ==== Partitioning large drives ====
quickreference/unix.txt · Last modified: by rodolico