LinuxShell控制台向其它用户发消息可以用 `write` 和 `wall`

258 阅读1分钟

向其它用户发消息可以用 writewall

write 向指定用户发消息
write user001 #回车
输入要发送的信息后回车
按 两次CTRL+D 或者 一次CTRL+C

wall 向所有用户发消息
wall hello world 回车

加双引号多行

wall "这是多行消
来自root
第一行
第二行"

先执行wall命令, 然后输入文本, 再按 Ctrl+d 发送

wall 回车
输入消息
按  `Ctrl+d` 发送

查看有哪些用户登录控制台的命令是 w

例如

[root@FedoraServer36 sshd_config.d]# w
 08:25:38 up 58 min,  4 users,  load average: 0.00, 0.02, 0.08
USER     TTY        LOGIN@   IDLE   JCPU   PCPU WHAT
z        tty1      07:27   50:25   0.04s  0.04s -bash
z        pts/0     07:31   46:26   0.01s  0.01s -bash
root     pts/1     07:36    1.00s  0.03s  0.00s w
z        pts/2     07:41   44:26   0.01s  0.01s -bash
[root@FedoraServer36 sshd_config.d]# type w
w 已被录入哈希表 (/usr/bin/w)
[root@FedoraServer36 sshd_config.d]# which w
/usr/bin/w
[root@FedoraServer36 sshd_config.d]# w --help

Usage:
 w [options]

Options:
 -h, --no-header     do not print header
 -u, --no-current    ignore current process username
 -s, --short         short format
 -f, --from          show remote hostname field
 -o, --old-style     old style output
 -i, --ip-addr       display IP address instead of hostname (if possible)

     --help     display this help and exit
 -V, --version  output version information and exit

For more details see w(1).
[root@FedoraServer36 sshd_config.d]#