Questions tagged [w]

Tag for questions concerning the 'w' command, a tool used to display currently logged-in users and their activities.

The w command is a Unix/Linux command-line tool that can be used to display the currently logged-in users and the commands they are running. The output includes the uptime (in the same format as returned by uptime), and then a list of user logins and the command-line run from that login, similar to the information provided by who and ps/top.

22 questions
12
votes
1 answer

How does the `w` command know the idle time and the running command?

The w command shows a bunch of information about who's logged in what they are doing. Example from Wikipedia: $ w 11:12am up 608 day(s), 19:56, 6 users, load average: 0.36, 0.36, 0.37 User tty login@ idle what smithj pts/5 …
user193130
  • 222
  • 1
  • 6
9
votes
1 answer

Different outputs for `w`, `who`, `whoami` and `id`

In command line platforms online, like for instance the one on Codecademy, when I run for cmd in w who whoami id do echo $cmd $cmd echo ========================= echo " " done I…
whoami
  • 93
  • 1
  • 4
8
votes
2 answers

What does "w" do with urandom?

> strace w 2>&1 | grep urandom read(4, "/usr/bin/grep\0urandom\0", 2047) = 22 > Why does "w" need urandom? How to avoid this? UPDATE: > strace w 2>&1 | awk '/urandom/' read(4, "awk\0/urandom/\0", 2047) = 14 > so it is the filtering that…
Marina Ala
  • 371
  • 3
  • 5
  • 16
8
votes
3 answers

Can not evoke watch command with non-integer time option

I want to start the w command periodically, according to man watch the smallest possible time interval is 0.1. I tried: watch -n1 w (works) watch -n1.5 w (does not work) watch -n0.1 w (does not work) When I try to start the watch…
Abdul Al Hazred
  • 25,760
  • 23
  • 64
  • 88
7
votes
2 answers

who shows (unknown) user logged-in: what's going on?

In a RHEL 7.3 server, I was trying to find logged-in users. I ran w and it told me there were two users, but it only showed me the info of one (myself); then I ran who, which displayed the other user as (unknown). Finally, I ran lastlog, with…
Samuel
  • 292
  • 3
  • 10
4
votes
1 answer

Why does the "w" command report a wrong number of logged in users?

I have logged in from tty6, then logged out. Now, executing the w command from a terminal inside unity gives the following output: mark@mark-Latitude-D620:~$ w 19:27:19 up 2:40, 3 users, load average: 0.41, 0.61, 0.46 USER TTY FROM …
Hinklo
  • 261
  • 4
  • 11
3
votes
2 answers

w command doesn't show all pseudo-terminal sessions

If I open terminal and execute w command then it will show: user tty7 :0 12:04 39:56 36.87s 0.06s /sbin/upstart - Now if open terminator or xterm and execute w command then it will show it's entry in the output of w command…
Prvt_Yadav
  • 5,732
  • 7
  • 32
  • 48
3
votes
3 answers

How to see what a user is doing in their ssh session

I logged into a server as root and did w, this let me see that a user was editing a file. someuser pts/5 10.117.0.53 14:03 3:25 1.20s 1.14s vi somefile.py Then I disconnected, and reconnected as root again later. I did a w again but…
LINUX G33NYUS
  • 716
  • 1
  • 12
  • 22
3
votes
6 answers

How to see which file a user is editing in vi

If I do a w, I can see that a user is editing a certain file in vi. However there are several files with the same name in different directories. How do I see which of these files is the one that the user is editing?
LINUX G33NYUS
  • 716
  • 1
  • 12
  • 22
1
vote
1 answer

How to check where users come from?

w command displays useful information about where users come from and what are they doing. A example of its output is: ~ $ w -V procps version 3.2.8 ~ $ w 13:53:14 up 164 days, 3:12, 5 users, load average: 0.00, 0.01, 0.00 USER TTY …
RSFalcon7
  • 4,367
  • 6
  • 30
  • 56
1
vote
1 answer

Inconsistent behavior of `w` command concerning `WHAT` column

I run w command on two machines. They both have exactly the same system installed: Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-87-generic x86_64). I am logged in as hans on both machines through SSH. machine foo: $ w 13:18:20 up 26 days, 6:02, 1 user, …
hans
  • 111
  • 3
1
vote
1 answer

How do I keep running a command in the same area of the console window? ("w")

I'm looking at the output of w: ehryk@ArchHP ~> sudo w 14:12:37 up 4:08, 4 users, load average: 2.18, 1.93, 1.55 …
Ehryk
  • 1,822
  • 3
  • 20
  • 22
1
vote
3 answers

Wrong number of logged in users using "w"

There was a temporary network glitch and all user terminal ssh sessions were broken. Upon logging in to the CentOS server again and running the "w" command lists a higher number of users logged in than they actually. It adds up the users whose…
Ankit
  • 439
  • 2
  • 6
1
vote
1 answer

How does Linux system synchronize wtmp and /var/run/utmp?

Linux system normally stores current user login information in /var/run/utmp, and stores historical information in /var/log/wtmp. So, how does it synchronize information between them, When a login happens, does it write to both of these files or…
daisy
  • 53,527
  • 78
  • 236
  • 383
0
votes
0 answers

How can I parse the output of w to collect current user sessions?

I want to parse the output of w so I can collect current user sessions and record them via telegraf. However, it only provides space separated output and I'm not sure how to reliably parse this without potentially splitting the 'command' field into…
1
2