linux wall命令_如何在Linux上使用wall命令

linux wall命令

linux wall命令

Linux terminal running on a laptop
Fatmawati Achmad Zaenuri/Shutterstock.com Fatmawati Achmad Zaenuri / Shutterstock.com

Need to get a quick message out to all logged-in users? Linux’s wall command is punchier than email and auto-targets the logged-in users. It broadcasts a message to everyone using a terminal on a system.

是否需要向所有登录用户快速发送消息? Linux的wall命令比电子邮件更强大,并且可以自动定位已登录的用户。 它使用系统上的终端向所有人广播消息。

墙命令 (The wall Command)

If you need to get a message out—fast—to the logged-in users of your computer, how do you do it? Email doesn’t satisfy the requirements. You don’t know when the email will be read. If you need people to know something right now, that doesn’t cut it. And anyway, you don’t want to clog up the inboxes of logged-out users who don’t need to see the message.

如果您需要快速地向计算机的登录用户发送消息,该如何做? 电子邮件不符合要求。 您不知道何时阅读电子邮件。 如果您需要人们立即了解某些内容,那并不会减少它。 而且无论如何,您都不想阻塞不需要查看消息的已注销用户的收件箱。

Without exerting a bit of extra effort and wasting some time, you’re not going to know who is logged in and from where. Your system could be located in Aberdeen, Washington but you might have remote users logged in from Aberdeen, Scotland. So how can you target a message specifically at the logged-in users?

如果不付出额外的努力和浪费一些时间,您就不会知道谁登录以及从哪里登录。 您的系统可能位于华盛顿的阿伯丁,但您可能有从苏格兰阿伯丁登录的远程用户。 那么,如何才能将消息专门定向到已登录的用户?

Linux and other Unix-like operating systems give you a simple way to do this. The wall command is like a forceful telegram. It will deliver a message to all terminal users, and it dumps the message right under their nose. The users can’t miss it, and you know they’ve got it. You don’t need them to choose to open an application to see if they have a message waiting.

Linux和其他类似Unix的操作系统为您提供了一种简单的方法。 wall命令就像是一封有力的电报。 它将向所有终端用户传递一条消息,并将该消息转储到他们的鼻子底下。 用户不会错过它,而且您知道他们已经了解了它。 您不需要他们选择打开应用程序来查看他们是否有消息等待。

The delivery is as subtle as a custard pie in the face.

交付就像脸上的蛋ust一样微妙。

发送信息 (Sending A Message)

The test machine that this article was researched on was installed with Fedora Linux, but the wall command will behave precisely the same on other distributions.

本文研究的测试机已安装在Fedora Linux上 ,但wall命令在其他发行版上的行为将完全相同。

The one difference you might encounter is some Linux distributions require you to use sudo on the option for sending a message from a text file, while other distributions require you always to use sudo with wall all the time. That’s actually a difference between Linux distributions, not a difference to the operation of the wall command itself.

您可能会遇到的一个区别是,某些Linux发行版要求您在选项上使用sudo从文本文件发送消息,而其他发行版则要求您始终始终将sudowall一起使用。 这实际上是Linux发行版之间的差异,而与wall命令本身的操作没有差异。

To send a message to all users, type wall, a space, then the message you wish to send. With Fedora Linux, you must use sudo.

要将消息发送给所有用户,请键入wall ,一个空格,然后输入您要发送的消息。 对于Fedora Linux,必须使用sudo

sudo wall Main printer offline until further notice.
wall command in a terminal window

Your message will be sent out to all users who have a terminal window open.

您的消息将发送给所有打开了终端窗口的用户。

Local users RIa and Tom receive the message, as does remote user Dick, who happens to be working on a computer running Ubuntu.

本地用户RIa和Tom会收到该消息,而远程用户Dick也恰好在运行Ubuntu的计算机上工作。

wall message to local user Ria in a terminal window
wall message to local user tom in a terminal window
wall message to a remote user in a terminal window

They all get the message at the same time, and you’re not left wondering whether they’ve seen it.

他们都同时收到消息,您不必怀疑他们是否已看到消息。

从文件发送消息 (Sending a Message From a File)

You can prepare your message in a text file and store it ready to send. If you have a repeating cycle of messages that need to be sent, you can create a library of pre-packed messages so that you don’t need to re-type them again and again.

您可以将消息准备为文本文件,然后将其存储以备发送。 如果您需要重复发送消息,则可以创建一个预包装消息库,这样就不必一次又一次地重新键入消息。

The message in the text file message.txt has been displayed to the terminal window with the cat command to make sure it is the one we want to send.

文本文件message.txt已通过cat命令显示在终端窗口中,以确保它是我们要发送的消息。

The message is then sent by passing the name of the text file to the wall command as a command line parameter:

然后通过将文本文件的名称作为命令行参数传递给wall命令来发送消息:

cat message.txt
sudo wall message.txt
wall command used with a text file in a terminal window

As before, local users Ria and Tom (and everyone else that is logged in with an open terminal window), and remote user Dick receive the message.

和以前一样,本地用户Ria和Tom(以及使用打开的终端窗口登录的所有其他用户)和远程用户Dick都会收到此消息。

wall message to Ria in a terminal window
wall message to Tom in a terminal window
wall message to Dick in a terminal window

讯息礼节 (Messaging Etiquette)

Because the wall command will push the message out to all terminal users no matter what, it can be a jarring experience to receive one. Use of the wall command should be kept to a minimum and only used where there is a genuine need. Otherwise, it will rapidly become very grating.

因为wall命令无论如何都会将消息推送给所有终端用户,因此接收消息可能是一种令人不快的体验。 应该尽量减少使用wall命令,并且仅在真正需要的情况下使用。 否则,它将Swift变得非常刺眼。

A wall message will stamp over whatever else is on the user’s terminal. It doesn’t actually overwrite anything–it won’t change the text it has landed on top of—but it will obscure it. And that can be alarming for a user that doesn’t know this.

wall消息会盖在用户终端上的其他内容上。 它实际上并不会覆盖任何内容,也不会更改它上面放置的文本,但是会使其模糊。 对于不知道这一点的用户,这可能会令人震惊。

Imagine one of our local users is editing an important file in Vi just as the wall message is sent.

试想一下,我们的本地用户的一个编辑的一个重要文件, Vi只为wall发送消息。

editing a file in vi in a terminal window

The message arrives right in the middle of her file.

邮件将立即到达她文件的中间。

wall message stamping over a file in vi in a terminal window

All our user needs do to restore the correct view of the file is to page up and down a little way through the file.

用户要恢复文件的正确视图所要做的就是在文件中上下翻页。

restored edit file in vi in a terminal window

It’s easy enough to restore the display to a state where work can continue, and blood pressure can recede, but too many interruptions of that sort are going to leave you with a very riled set of users.

将显示恢复到可以继续工作的状态很容易,并且血压可以降低,但是这种中断太多会给您带来非常生气的用户。

So, as handy as wall is, use it in considered moderation.

因此,就像wall一样方便,请适度使用它。

图形桌面用户呢? (What About Graphical Desktop Users?)

The wall command reaches everyone logged in with a terminal open, but it won’t reach anyone who’s using a graphical desktop environment without a terminal window open.

wall命令可用于在打开终端的情况下登录的每个用户,但在未打开终端窗口的情况下,不会访问正在使用图形桌面环境的任何用户。

If someone is using a graphical desktop and has a terminal window open, they’ll see it in the terminal window—but that’s it. Don’t count on wall to reach anyone outside of the terminal.

如果某人正在使用图形桌面并且打开了终端窗口,那么他们会在终端窗口中看到它-就是这样。 做不算wall到达终点的人之外。

Subtle it isn’t, but you can’t deny it does get the message across—in a traditional terminal environment, that is.

并非如此,但您不能否认它确实在整个传统终端环境中传达了信息。

翻译自: https://www.howtogeek.com/415914/how-to-use-the-wall-command-on-linux/

linux wall命令

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值