On Thu, 7 May 2026 at 12:17, Vincent Lefevre <[email protected]> wrote:

> Note: I don't know whether this is an upstream bug or this is specific
> to the Debian package, as Debian has a number of patches for "w", some
> of them for the addition of the -t (--terminal) option, though they
> come from the upstream repository (but there might be a divergence).
>
I'd be curious about that myself. 4.0.4-9 does have the upstream 4.0.6 w -t
patches,
so it should be the same.

I use Gnome terminal myself, so it works fine for me.

The way terminal mode works is that it scans all processes and sorts by tty
and PID.
So something like "ps -e -o tty,start,comm --sort=tty,pid"

look for the tty column to change, that process start time is the login
time.

eg snipped ps output
[...]
pts/0      May 06 bash   <-- this
[...]
pts/1    20:46:26 bash <-- this
pts/2    20:57:50 bash <-- this
pts/2    21:03:03 vi
tty2       May 06 gdm-wayland-ses  <-- this
tty2       May 06 gnome-session-b

$ w -t
 21:12:04 up 1 day, 13:21,  1 user,  load average: 0.25, 0.26, 0.22
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU  WHAT
csmall   tty2     -                Wed07   37:21m  0.00s   ?
 /usr/libexec/gdm-wayland-session /usr/bin/gnome-session
csmall   pts/0    -                Wed13    4.00s  0.06s  0.06s w -t
csmall   pts/1    -                20:46   25:39   0.01s  0.01s bash
csmall   pts/2    -                20:57    4:15   0.56s  0.01s vi src/w.c

This method is used if there is no systemd session, as you've noticed there
isn't one for the terminal. That is actually the reason for -t mode
otherwise "normal" w would work.

So... why is the tty switch trick not working for your terminals?

 - Craig

Reply via email to