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.
radm pS 18.104.22.168 Sun01PM 1day -bash raj pW 192.168.1.100. 7:42AM 5 ssh email@example.com miku pX a80-186-82-84.el 7:28AM 10 screen irssi vivek pY 22.214.171.124 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 firstname.lastname@example.org 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.
🐧 10 comments so far... add one ↓
|Category||List of Unix and Linux commands|
|Disk space analyzers||df • ncdu • pydf|
|File Management||cat • tree|
|Firewall||Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04|
|Network Utilities||NetHogs • dig • host • ip • nmap|
|OpenVPN||CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04|
|Package Manager||apk • apt|
|Processes Management||bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time|
|Searching||grep • whereis • which|
|User Information||groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w|
|WireGuard VPN||Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04|