write (写入命令)

EE 发表于 2020-08-21 09:10
浏览次数:
在手机上阅读

在像 Unix 一样的操作系统上,写入命令向其他用户发送消息。

查看英文版

目录

1 write 运行系统环境

2 write 说明

3 write 语法

4 write 例子

write 运行系统环境

Linux

write 说明

写入实用程序允许您通过将线路从终端复制到其终端来与其他用户通信。

运行 write命令时,要写入的用户将获取格式的消息:

Message from yourname@yourhost on yourtty at hh:mm ...

您输入的任何其他行都将复制到指定的用户的终端。如果其他用户想要回复,他们也必须运行写入。

完成后,键入文件结束或中断字符。其他用户将看到消息"EOF",指示对话已结束。

您可以使用 mesg命令阻止用户(超级用户以外的人)写信给您。

如果要写入的用户登录到多个终端,可以通过指定终端名称作为写入命令的第二个操作数来指定要写入的终端。或者,您可以让写入选择其中一个终端,它会选择一个最短的空闲时间。因此,如果用户在工作登录时也从家里拨号,消息将转到正确位置。

写入某人的传统协议是,字符串'-o',要么在行的末尾,要么在行本身,意味着轮到其他人说话了。字符串"oo" 表示此人认为谈话已经结束。

The write utility 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 message of the format:
Message from yourname@yourhost on yourtty at hh:mm ...
Any further lines you enter will be copied to the specified user's terminal. 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 command.
If the user you want to write to is logged in on more than one terminal, you can specify which terminal to write to by specifying the terminal name as the second operand to the write command. Alternatively, you can let write select one of the terminals and it will pick the one with the shortest idle time. So, 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 is the other person's turn to talk. The string ‘oo’ means that the person believes the conversation to be over.

查看英文版

查看中文版

write 语法

write user [tty]

选项

user 要写入的用户。
tty 如果用户登录到多个会话,则要写入的特定终端。
write user [tty]

Options

user The user to write to.
tty The specific terminal to write to, if the user is logged in to more than one session.

查看英文版

查看中文版

write 例子

write hope

写一条消息给用户 hope. 输入此命令后,您将被放置在空白行上,其中键入的所有内容都将发送给其他用户(一行一行)。键入中断字符(默认情况下为 Ctrl-C)将返回到命令提示符并结束写入会话。

write hope tty7

在终端tty7上给用户hope写一条信息。

write hope

Write a message to the user hope. After entering this command, you will be placed on a blank line, where everything you type will be sent to the other user (line by line). Typing the interrupt character (Ctrl-C, by default) will return you to the command prompt and end the write session.

write hope tty7

Write a message to the user hope on terminal tty7.

查看英文版

查看中文版

其他命令行

whereis | wc | which | w | whatis | who | whoami | whois | wait | wall |

如此好文,分享给朋友
发表评论
验证码:
评论列表
共0条