Linux / UNIX find out what other users are doing?

by on January 17, 2006 · 9 comments· LAST UPDATED October 2, 2007

in , ,

Q. Can you explain the command to find what users are doing on my UNIX / Linux system?

A. Both Linux and UNIX (FreeBSD/Solaris) has w command to show who is logged on and what they are doing.

The w command prints a summary of the current activity on the system, including what each user is doing.

=> The first line displays the current time of day

=> How long the system has been running

=> The number of users logged into the system

=> The load averages. The load average numbers give the number of jobs in the run queue averaged over 1, 5 and 15 minutes.

You can also use ps command which shows you process that are running on the system.

Type w command displays information about the users currently on the machine, and their processes.

Show who is logged on and what they are doing with w command

The fields output are the user's login name, the name of the terminal the user is on, the host from which the user is logged in, the time the user logged on, the time since the user last typed anything, and the name and arguments of the current process.
$ w
Output:

radm    pS 66.90.90.102     Sun01PM  1day -bash
raj     pW 192.168.1.100.  7:42AM     5 ssh root@202.54.1.20
miku    pX a80-186-82-84.el  7:28AM    10 screen irssi
vivek   pY 196.15.193.111    4:11AM     0 nano -w hireme
rani    q0 dslbr0.bsnl.in    7:32AM    12 lynx http://slashdot.org/
jadmin  q2 dslbr5.bsnl.in    7:33AM     0 ssh jadmin@host.cyberciti.info
gad     q3 dslbr76.bsnl.in   7:40AM     0 -ksh
bencs   q5 dslbr22.bsnl.in   7:44AM     5 -zsh
vivek   q6 gw11-vsnl.in      7:47AM    11 -bash

You can use the ps command shows you processes that are running on the system:

$ ps -au | more
$ ps -au | less

So you can use both w and ps commands to find out who's doing what.

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 9 comments… read them below or add one }

1 vinod June 27, 2007 at 11:48 am

I want to know who all logged in and what files they have opened and modified

Reply

2 Keith Rose January 19, 2009 at 6:45 am

To vinod – Check the individual users .bash_history file. If they havent modified it, you will see all the commands they have executed.
type
vi /home/USERNAME/.bash_history
where USERNAME is the user who you want to check.

Reply

3 shailesh mishra April 16, 2009 at 8:39 am

Is there any way by which i can attach some terminal so that i can continually read that one ? What i want is that once i see on which terminal a user is logged in,i want to read that terminal so that i can ACTUALLY see whats that user is doing at that time.
I am aware of screen command but i suppose it requires user action.I actually want to monitor a particular users action in real time.

Reply

4 daulat kumar May 15, 2009 at 4:02 am

anyone can tell me what is the actual process use w command in linux system to display system and user information

Reply

5 Prabhakar Raokhande May 20, 2009 at 5:05 am

I want to know PID of the terminal which user has logged in and closed the connection without logging out. When I fire Who I can see some terminal process but coud not get there PID to kill those process.
Any one has idea how to find and kill these type of orphan process?

Reply

6 nixCraft May 20, 2009 at 8:21 am

use pkill command to kill users.

Reply

7 Denise December 5, 2009 at 4:14 am

How do i get more specific about the Process done?

Reply

8 bhuvana February 26, 2013 at 5:01 am

how can i know who are all accessing my file????

Reply

9 bhuvana February 26, 2013 at 5:01 am

how can i know who are all accessing my file in unix????

Reply

Leave a Comment

Tagged as: , , ,

Previous Faq:

Next Faq: