
song tty2 2013-05-08 10:51
abc pts/02013-05-10 11:45 (192.168.2.136)
boy pts/12013-05-10 09:15 (192.168.12.172)
其次, 使用write user 并写下信息, 按CTRL+C 结束输入, 如:
write song
hello, how are you?
<TRL+C>
经时song这个用户可看到如下信息:
Message from xiewu@droider on pts/4 at 13:13 ...
hello, how are you?
EOF
------------------------------------
如果要启用/禁止其他用户向你发信息, 可用mesg命令:
mesg [y|n]
y Allow write access to your terminal.
n Disallow write access to your terminal.
禁止接受其它用户向你发信息可在命令行输入:
mesg n
-------------------------------------
如果想向所有的登陆用户发信息, 可以使用wall命令。
与write 命令类似的命令还有talk.
向Linux登录终端发消息原创 2013年02月17日 18:00:09 1600
同一台服务器,可能有很多个用户登录在上面,每个用户都是一个系统终端,可以向其他终端发送消息,同在服务器上开发的开发人员可以简单的互动(不能回复)一下哈!
一,效果
先登录一个终端,如下:
[html] view plain copy
[root@localhost /]# who
root tty1 2013-02-16 18:14 (:0)
root pts/02013-02-17 02:01 (:0.0)
[root@localhost /]#
登录的终端为pts/0。然后再打开一个终端,如下:
[html] view plain copy
[root@localhost /]# who
root tty1 2013-02-16 18:14 (:0)
root pts/02013-02-17 02:01 (:0.0)
root pts/12013-02-17 02:02 (:0.0)
[root@localhost /]#
此时登录的终端为pts/1。现在假设pts/1发消息给pts/0。
[html] view plain copy
[root@localhost /]# write root pts/0
hello
在pts/0终端上收到消息如下:
[html] view plain copy
[root@localhost /]#
Message from root@localhost.localdomain on pts/1 at 02:03 ...
hello
在pts/0上只是收到消息,不能回复的。
再看一下write命令的解释吧
NAME
write - send a message to another user
SYNOPSIS
write user [ttyname]
DESCRIPTION
Write allows you to communicate with other users, by copying lines from
your terminal to theirs.
When you run the write command, the user you are writing to gets a mes-
sage of the form:
Message from yourname@yourhost on yourtty at hh:mm ...
Any further lines you enter will be copied to the specified user’s ter-
minal. If the other user wants to reply, they must run write as well.
When you are done, type an end-of-file or interrupt character. The
other user will see the message EOF indicating that the conversation is
over.
You can prevent people (other than the super-user) from writing to you
with the mesg(1) command. Some commands, for example nroff(1) and
pr(1), may disallow writing automatically, so that your output isn’t
overwritten.
If the user you want to write to is logged in on more than one termi-
nal, you can specify which terminal to write to by specifying the ter-
minal name as the second operand to the write command. Alternatively,
you can let write select one of the terminals - it will pick the one
with the shortest idle time. This is so that if the user is logged in
at work and also dialed up from home, the message will go to the right
place.
The traditional protocol for writing to someone is that the string
‘-o’, either at the end of a line or on a line by itself, means that
it’s the other person’s turn to talk. The string ‘oo’ means that the
person believes the conversation to be over.
SEE ALSO
mesg(1), talk(1), who(1)
write username 给某个用户发消息用命令 wall 给所有用户发消息。相当于write all
wall -- send a message to everybody’s terminal
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)