Linux 之 wall 命令

wall命令用于向所有已登录用户发送广播消息。本文介绍了wall命令的基本用法及应用场景,例如系统维护前的通知。wall命令支持-n选项来更改广播消息的抬头。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Linux 之 wall 命令

可以上墙的广播命令wall

Linux wall命令会将信息传给每一个 mesg 设定为 yes 的上线使用者(可以输入mesg,如果返回is yes就可以收到)。当使用终端登陆的时候,可以使用EOF (通常用 Ctrl+D)。所有人均可以使用该命令。

官方的定义为:

wall – send a message to everybody’s terminal.

所以wall应该是write all user’s teminal的缩写。

使用的方法为:

$ wall [-n] [ message ]

其中参数-n的含义为,修改显示的广播信息放松抬头,看示例即可明白。

这个命令的使用场景为如果需要升级维护系统,可以通过wall命令通知所有在线的用户。

如下:

$ wall
Dear all,
We want to make you aware that this weekend 12PM CST,
there will be scheduled down time for approximately 6 hours.
During this time we will add more capacity and software update
to our infrastructure and service.
Please save all your works and logout for safe.
See you next week.
Regards,
Admin
Ctrl+D #退出

所有登陆的终端都会收到这个消息:

Broadcast message from user@localhost (pts/4) (Mon Apr 18 22:02:22 2011):

Dear all,
We want to make you aware that this weekend 12PM CST,
there will be scheduled down time for approximately 6 hours.
During this time we will add more capacity and software update
to our infrastructure and service.
Please save all your works and logout for safe.
See you next week.
Regards,
Admin

需要注意的是,这个命令最大支持20行的信息,超过了就不会广播了。

如果使用-n参数的效果如下

$ wall -n 'hello'

# 其他终端用户收到的消息
Remote broadcast message (Mon Apr 18 22:05:22 2011):

hello

可以看到此时的通知抬头变成了 Remote broadcast message,去掉了是哪个用户发送的消息。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

我们编程吧

为吾笔墨赞赏,莫大荣幸鼓励!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值