How do I see everything a specific user is doing right now?

Quick Linux Tip #32:

Try: w linuxteck

Info: w <user> lists active sessions and current commands; ps -u <user> lists all running processes.

Examples:

  • $ w  # View all logged-in users
  • $ last linuxteck | head  # Check recent login history
  • $ lslogins linuxteck  # User account details and password policy

Note: w displays IDLE time (keyboard inactivity), JCPU (total process CPU), and PCPU (current task CPU). Perfect for rapid user auditing.




LinuxTeck.com
linuxteck@ubuntu:~$ w linuxteck
 10:34:56 up 12 days,  3:45,  3 users,  load average: 0.42, 0.38, 0.35
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
linuxteck pts/0    192.168.1.100    09:23   0.00s  0.15s  0.03s w linuxteck
linuxteck pts/1    192.168.1.100    09:45  15:23   0.08s  0.02s vim nginx.conf

linuxteck@ubuntu:~$ ps -u linuxteck -o pid,tty,time,cmd
  PID TT          TIME CMD
 3456 pts/0    00:00:03 -bash
 4567 pts/0    00:00:00 w linuxteck
 5678 pts/1    00:00:02 vim nginx.conf
linuxteck@ubuntu:~$

PREVIOUS ARTICLE Quick Linux Tip #31: My disk is 95% full but I don't know what's eating the space. How do I find out? NEXT ARTICLE Quick Linux Tip #33: How do I encrypt a sensitive file with just a password?
About John Britto

John Britto Founder & Chief-Editor @LinuxTeck. A Computer Geek and Linux Intellectual having more than 20+ years of experience in Linux and Open Source technologies.

View all posts by John Britto →

Leave a Reply

Your email address will not be published.