lsuser-0.4.1 is not a library.
lsuser
List system users in a clean, columnar layout.
Most operating systems do not provide a straightforward, consistent API for enumerating local user accounts. lsuser solves this by using raw POSIX libc calls (getpwent/setpwent/endpwent) to read the password database and present users in a readable table — or structured JSON for scripting.
Features
- Cross-platform — Works on macOS, Linux, and other Unix-likes via libc.
- Smart defaults — Filters out system accounts by default (UID < 500 on macOS, UID < 1000 or 65534 on Linux).
- Show all accounts — Use
-a/--allto include system daemon users. - Customizable columns — Choose which fields to display:
USER,UID,GID,REAL_NAME,HOME,SHELL. - JSON output — Use
-J/--jsonfor machine-readable output. - No external commands — Does not parse
/etc/passwddirectly or shell out todscl/getent.
Installation
Or build from source:
Usage
lsuser [OPTIONS]
| Flag | Description |
|---|---|
-a, --all |
List all users including system accounts |
-n, --noheadings |
Omit the header row |
-o, --output |
Comma-separated columns (USER,UID,GID,REAL_NAME,HOME,SHELL) |
-O, --output-all |
Show all available columns |
-J, --json |
Output as JSON |
Examples