Some Tips How To Monitor Users
From time to time there are going to be occasions where you will want to know exactly what people are doing on your system. Maybe you notice that a lot of RAM is being used, or a lot of CPU activity. You are going to want to see who is on the system, what they are running, and what kind of resources they are using.
The who command
The easiest way to see who is on the system is to do a who or w. The –> who is a simple tool that lists out who is logged –> on the system and what port or terminal they are logged on at.
[email protected]:~> who
dannys pts/0 May 23 09:33
tech pts/3 May 20 11:35
eversun pts/1 May 22 11:03
eversun pts/2 May 23 15:04
The ps command
we can see that user eversun is logged onto both pts/1 and pts/2, but what if we want to see what they are doing? We could to a ps -u eversun and get the following output
[email protected]:~> ps -u eversun
20876 pts/1 00:00:00 bash
20904 pts/2 00:00:00 bash
20951 pts/2 00:00:00 ssh
21012 pts/1 00:00:00 ps
The w command
Even easier than using the who and ps -u commands is to use the w. w will print out not only who is on the system, but also the commands they are running.
[email protected]:~> w
eversun :0 09:32 ?xdm? 30:09 0.02s -:0
eversun pts/0 09:33 5:49m 0.00s 0.82s kdeinit: kded
eversun pts/2 09:35 8.00s 0.55s 0.36s vi sag-0.9.sgml
eversun pts/1 15:03 59.00s 0.03s 0.03s /bin/bash
From this we can see that a kde session is running, and another terminal open sitting idle at a bash prompt.