2016年11月3日 星期四

[Linux 常見問題] Sending messages to another user

Source From Here
Question
Is there any command to send messages through the Linux shell to other people on the same network? I'm using write user and then write the message itself. But there's any command that doesn't show my username or that i'm trying to message them. The command I'm using will show this to the user I'm trying to contact (code taken from the web):
Message from root@dev.example.com on pts/1 at 17:11 ...

How-To
The only straightforward way I know of doing this is to use the wall command. This can be used to omit the sender's identification, via the -n switch.
// -n: Suppresses the normal banner printed by wall, changing it to "Remote broadcast message".
$ sudo wall -n hi
Remote broadcast message (Fri Nov 8 13:49:18 2013):

hi

using echo
This alternative method is more of a hack, since it isn't done through an explicit tool but you can echo text out to a users' terminal assuming you know which one they're on. For example:
# w // Check who is online now & You should be root
16:59:30 up 74 days, 10:33, 2 users, load average: 0.02, 0.05, 0.01
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
guest pts/2 xxx.d 16:56 1:38 0.01s 0.01s -bash
john pts/1 xxx.d 16:42 0.00s 0.16s 0.05s w


# echo "Hello World" > /dev/pts/2 // Say hello to account "guest"
# write guest /dev/pts/2 // Keep sending message to guest until you enter Ctrl+C


沒有留言:

張貼留言

[Git 常見問題] error: The following untracked working tree files would be overwritten by merge

  Source From  Here 方案1: // x -----删除忽略文件已经对 git 来说不识别的文件 // d -----删除未被添加到 git 的路径中的文件 // f -----强制运行 #   git clean -d -fx 方案2: 今天在服务器上  gi...