Overview
users prints, on one line, the names of the users logged in now, sorted, with a name repeated for each session. With nobody in the login records it prints nothing, or an empty line on some systems. who shows more detail.
Background
The users command appeared in 3.0BSD, according to the macOS manual. Today the name covers GNU users and the users that macOS ships. The BusyBox 1.37.0 build used for this page has no users applet.
Examples
Run it; the output depends on who is logged in, so only success is shown:
users > /dev/null && echo ok
Send the output to a pipe and check that the command still succeeds when nobody is logged in; the output may be empty:
users | cat > /dev/null && echo ok
Common mistakes
users reads the system login records, so a session that did not register there, such as some containers or remote tools, does not appear. A user with two terminals is listed twice. It shows names only; use who to see terminals and times.
Portability
This page has no BusyBox view: BusyBox has no users applet. The output depends on the system, so the Common examples check only that the command succeeds. The Common examples were executed on GNU coreutils 9.11 and macOS system tools (see the development guide for the exact check).
About macOS users
This is the users in the system folders of macOS. It follows the BSD implementation.
References
Original explanations, with upstream documentation for further reading. FreeBSD references are comparison material, not a claim of Apple version equivalence.