---

Bash One-Liner Script To Produce Somewhat-Fancy Output Of Who’s Logged In

[ Thanks to Mike
Golvach
for this link. ]

“That is, as I’ve always understood, one of the main
reasons to script things out in the first place. The other reasons,
like automation, efficiency, etc, are pretty much ignored here,
even though we will be automating a repetitive action and that, by
definition, will make our waste of company time more efficient. No
matter how you look at them, automation and efficiency always seem
to be a good thing 😉

“This “script” is really just a simple pipe-slam so that we can
figure out who’s on the machine with us (my preference is for a
script, but – as you’ll soon see – this could just as easily be an
alias, etc). Sure, we could just type “w” or “who,” (and “w” does
form the base of this bash one-liner script), but we’d like to have
this whole thing look more personal. And by personal, I mean, we’d
like to know who else is on other than us by UID or login name. The
functionality (or relative merit) of this script depends heavily on
the way in which users were created on your machine in the first
place. If no “comment” (or “gecos”) field is populated for users on
your system, this command-chain is completely worthless.”


Complete Story

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends, & analysis