In a professional environment with traditional application you often want (or are asked) to report the users.
Traditionally there is the who command telnetd or sshd register the users in the utmp file, to be shown with who, w, users, finger, pinky, ...
In addition they register the users in the wtmp file, to be shown with the last command.
Also traditional shell windows like xterm do it.
But recent gnome-terminal and mate-terminal have dropped support for utmp/wtmp.
There seems to be an agreement among desktop developers.
Another example:
When starting a desktop, the first shell on the system no longer registers to utmp/wtmp.
(Further, it does not even run as a login shell. I.e. it does not read .profile. Linux distros do crazy work-arounds like sourcing .profile from the system's bashrc.)
Multi-desktop/application providers like Citrix (with products XenApp/XenDesktop for Linux) no longer do a registration.
Now to the solutions. I found the best way is to run a ps command.
As stated by How to see how many users in Linux:
Of course this is incorrect in Linux: the h option is BSD-only and forces the ps into BSD mode. And by convention you should not use a dash then.
Correction:
Removing the duplicates with awk is faster than sort -u
How to do this on Posix-compatible systems?
There is no "show for all users with tty" option.
But one can display the ttys and let awk select the valid ones
Note: the user= must be last, otherwise the chance is high that long usernames are truncated (e.g. Linux does it).
Last edited by MadeInGermany; 07-01-2019 at 04:15 PM..
Reason: title corrected
These 6 Users Gave Thanks to MadeInGermany For This Post:
So I'm trying to write a single line command So I have to use last first in this command and I've figured out the format my professor wants it in, something like thislast | cut -d' ' -f1,15 | sort > check | uniq -c.... and I never can get it right, when I just last command I get something... (2 Replies)
how to find out total number of users logged in a server from uptime . i mean to say i need the total output of unix command . who gives the out put at a particular time . I need at all time from which machine who has connected , (3 Replies)
Is it possible to get a list of users sorted by the number of processes executed by each.
I have a HP - UX server with 2800 processes running currently.
And I want to know the number of processes owned by each person logged in to that server.something like below:
user1 : 150 Processes
user2 :... (2 Replies)
My admin needs a shell script in Korn that will show conditions based on users logged in. I have never used the Korn shell and have no clue what I am doing, can anyone help.
here are the conditions that need to be returned.
if users are below 5
displays should be: performance is high
if... (1 Reply)
A Newbie here,
I am working on a script and am having problems with the else part of the script. I can't get the users who are not logged into the system to display on the screen with their username and the text "The user is not logged in". I am sure it is something simple and stupid, but I... (5 Replies)
How do I find this out? I have a feeling its a simple command such as who, but I just don't know what it is. I've had a search on here but either I can't put it into the right search criteria or there isn't a topic on it.
Thanks.
EDIT: Delete this thread, as I posted it I noticed the... (0 Replies)
I have searched the forums but have not mangaed to quite find what im looking for. I have used to /etc/passwd command to present me a list of all users the who command to present all users currently logged on, but what i want to know is what command can i use to display users that are registered... (12 Replies)
Discussion started by: warlock129
12 Replies
8. Post Here to Contact Site Administrators and Moderators