APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

2005/03/03 users

© March 2005 Tony Lawrence

Without 'users', if you just want a simple list of who's logged in, you have to run "w" or "who" and pipe it through awk, or cut or sed or whatever to extract the one piece of information you actually wanted. Well, your cpu may need the exercise, and we don't want sed, awk and cut to never get any attention (commands get rusty if not used frequently), but "users" is just what it says: folks logged in, only folks logged in, no extra info. If somebody is logged in more than once, you'll get them listed that many times. Nothing more to see folks, move along quietly.

I lied. There is more to it. It can actually take an optional argument, which is the name of a file it should read instead of the default /var/run/utmp. If you did "users /var/log/wtmp", you would (usually) get much more output - each name would be listed as many times as it had records in wtmp. I'm not sure how useful that would be, but there it is. You also might have, for reasons you choose not to discuss, copied utmp somewhere at some particular point in time and might run "users" with that file as its argument. Why? I don't know, you're the one who copied utmp!

But that's all there is to it. Really. Oh, OK, fine, there's a --version argument and --help. Sheesh, like that matters.

Got something to add? Send me email.

(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> list logged in users

Inexpensive and informative Apple related e-books:

Take control of Apple TV, Second Edition

Take Control of High Sierra

iOS 10: A Take Control Crash Course

Take Control of Upgrading to El Capitan

Take Control of Numbers

More Articles by © Tony Lawrence

Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

Printer Friendly Version

Security is mostly a superstition. It does not exist in nature, nor do the children of men as a whole experience it. Avoiding danger is no safer in the long run than outright exposure. Life is either a daring adventure, or nothing. (Helen Keller)

Linux posts

Troubleshooting posts

This post tagged:



Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode