68 Words

Display the number of logged-in users with the who command

Keeping track of the number of users logged into a system can be very useful. This short Bash command shows the exact number of active users:

who -q | grep "users=" | sed 's/# users=//g'

For a continuous, real-time update of the user count, run it with watch:

watch "who -q | grep 'users=' | sed 's/# users=//g'"