wall Command in Linux: Broadcast Messages to Logged-In Users

By 

Updated on

5 min read

Using the Linux wall command to broadcast a message to all logged-in users

wall is a command-line utility that displays a message on the terminals of all logged-in users. The messages can be typed directly on the terminal or read from a file. wall stands for “write all”; to send a message to a specific user, use the write command.

Usually, system administrators send messages to announce maintenance and ask users to log out and close all open programs. The messages are shown to all logged-in users with a terminal open. Users using a graphical desktop environment with no terminal open will not see the messages. Each user can control the write access to their terminal with the mesg utility. When the superuser invokes the wall command, all users receive the messages, no matter their mesg settings.

wall Command Syntax

The syntax for the wall command is as follows:

txt
wall [OPTIONS] [<FILE>|<MESSAGE>]

If no file is specified, wall reads the message from the standard input.

Broadcasting a Message

The most straightforward way to broadcast a message is to invoke the wall command with the message as the argument:

Terminal
wall "The system will be restarted in 10 minutes."
output
Broadcast message from root@linuxize.host (pts/0) (Sun Oct  4 19:22:07 2020):

The system will be restarted in 10 minutes.

The message will be broadcast to all users that are currently logged in. To see all logged-in users, run the w or who command.

To suppress the banner and show only the text to the logged-in users, invoke the command with the -n (--nobanner) option:

Terminal
wall -n "The system will be restarted in 10 minutes."
output
The system will be restarted in 10 minutes.

If you want to write multi-line messages, invoke the command without an argument:

Terminal
wall

The wall command will wait for you to enter text. When you are done typing the message, press Ctrl+D to end the program and broadcast the message.

You can also pipe the output of another command to wall. Here is an example showing how to use the echo command to broadcast multi-line messages:

Terminal
echo "The system will be restarted in 10 minutes. \nPlease save your work." | wall

Broadcasting a Message From a File

If you are regularly sending the same messages, you can write each one of them to a file, so that you do not need to re-type the same text. In normal usage, wall can read from a file as a regular user. File input is refused only in specific setuid/setgid scenarios when the invoker is not root.

To broadcast the contents of a file, invoke the wall command followed by the file name:

message1_file.txttxt
The system will be restarted in 10 minutes.
Terminal
wall message1_file.txt
output
Broadcast message from root@linuxize.host (pts/0) (Sun Oct  4 19:25:06 2020):

The system will be restarted in 10 minutes.

Broadcasting a Message to a Group

To send a message only to members of a given group, run the command with the -g (--group) option, followed by the group name. For example, to write only on the terminals of the members of the “devs” group, you would run:

Terminal
wall -g devs "The system will be restarted in 10 minutes."

The group can also be specified by its GID (group ID). For more information on managing groups, see the groupadd command guide .

Quick Reference

CommandDescription
wall "message"Broadcast a message to all logged-in users
wall -n "message"Broadcast without the banner header
wall -g group "message"Broadcast to members of a specific group
wall file.txtBroadcast the contents of a file
echo "msg" | wallPipe a command’s output to wall

Troubleshooting

A user is not receiving the message
The user may have disabled write access to their terminal with mesg n. Regular users can block messages this way. When wall is run as root, messages are delivered regardless of mesg settings.

Message does not appear for desktop users
wall writes to terminal devices only. Users logged into a graphical desktop environment without an open terminal will not see the broadcast.

Permission denied when reading a file
This is uncommon in normal usage. It can happen in specific setuid/setgid cases when wall refuses file input for non-root users. Try piping input instead, for example: cat file.txt | wall.

FAQ

What is the difference between wall and write?
wall sends a message to all logged-in users. The write command sends a message to a single specific user.

Can a regular user run wall?
Yes, but recipients can block messages with mesg n. When root runs wall, all users receive the message regardless of their mesg setting.

Why do some users not see the message?
They either have mesg n set on their terminal, are not logged into a terminal (graphical session only), or their terminal emulator does not display system messages.

How do I schedule a wall message before a shutdown?
Use the shutdown command, which sends a wall message automatically before powering off. For example: sudo shutdown -r +10 "Rebooting in 10 minutes.". You can also use reboot for immediate reboots.

Does wall work over SSH?
Yes. Any user with an active SSH session that has a TTY (not a non-interactive session) will receive the message on their terminal.

Conclusion

The wall command writes a message on the terminals of all currently logged-in users. It is commonly used by system administrators before planned maintenance or shutdowns .

If you have any questions, feel free to leave a comment below.

Linuxize Weekly Newsletter

A quick weekly roundup of new tutorials, news, and tips.

About the authors

Dejan Panovski

Dejan Panovski

Dejan Panovski is the founder of Linuxize, an RHCSA-certified Linux system administrator and DevOps engineer based in Skopje, Macedonia. Author of 800+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.

View author page