0

Through the man who appears the following for the -T option

  -T, -w, --mesg
          add user's message status as +, - or ?

According with some tutorials, if is executed who -T should appears these symbols.

In my case - appears for all the users logged through tty and + for all the users logged through ssh - nothing about ?

What do the - + ? symbols represent with the -T option?

1 Answer 1

3

The "message status" tells you whether the user accepts messages on that particular TTY.

Here, my shell session is running on /dev/pts/3:

$ tty
/dev/pts/3

My message status on this TTY, as well as on the other TTYs that I'm using, is +, meaning I accept messages:

$ who -T
kk       + pts/0        2022-04-23 14:32 (192.168.1.107)
kk       + pts/1        2022-04-23 13:02 (tmux(2971).%0)
kk       + pts/2        2022-04-23 13:02 (tmux(2971).%1)
kk       + pts/3        2022-04-23 13:02 (tmux(2971).%2)
kk       + pts/4        2022-04-23 14:32 (tmux(2971).%3)

I then turn off the ability for other users to send messages to me (using e.g. write; see man write and man mesg):

$ mesg n

This affects the message status:

$ who -T
kk       + pts/0        2022-04-23 14:32 (192.168.1.107)
kk       + pts/1        2022-04-23 13:02 (tmux(2971).%0)
kk       + pts/2        2022-04-23 13:02 (tmux(2971).%1)
kk       - pts/3        2022-04-23 13:02 (tmux(2971).%2)
kk       + pts/4        2022-04-23 14:32 (tmux(2971).%3)

If the message status is ?, this means the terminal device is unknown.

The following is from the GNU who info manual (info '(coreutils)who invocation'), relating to the -T option:

After each login name print a character indicating the user’s
message status:

     ‘+’ allowing ‘write’ messages
     ‘-’ disallowing ‘write’ messages
     ‘?’ cannot find terminal device

The who utility is a POSIX utility, and in the POSIX standard, the -T option adds a terminal state with four possible values: +, -, ? and (space). The specification describes these like so:

  +       The terminal allows write access to other users.

  -       The terminal denies write access to other users.

  ?       The terminal write-access state cannot be determined.

  <space> This entry is not associated with a terminal.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .