Think before you speak, read before you think.

linux write命令给其他用户发消息

使用w或`last | grep stil`可以查看到哪些用户正在登陆

11:46:19 up 82 days, 5:58, 2 users, load average: 0.00, 0.01, 0.05
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
jpuyy pts/0 192.168.1.2 11:45 3.00s 0.53s 0.00s w
jpuyy pts/3 192.168.1.3 11:45 19.00s 0.57s 0.57s -bash

现在在pts/0向pts/3的jpuyy用户写消息

jpuyy@ip-172-31-11-178:~$ sudo write jpuyy pts/3

[sudo] password for jpuyy:

write: warning: write will appear from jpuyy
foo
bar

当发送命令后,对方会收到一条

Message from yourname@yourhost on yourtty at hh:mm …
foo
bar

方便在没有其他通讯的时候发消息,测试下来不支持中文。


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *