There are times when multiple users are logged in to a server computer, and you – the system/network admin – need to, say, restart the server to perform some maintenance task. Of course, the correct way is to inform all those who are logged in about theĀ maintenance activity.

Thankfully, Linux offers a built-in command line utility for this purpose. The tool in question is Wall, and in this tutorial, we will discuss the basics of this tool using some easy-to-understand examples. But before we do that, it’s worth mentioning that all examples in this article have been tested on an Ubuntu 22.04 LTS machine.

Linux wall command

As already mentioned, the wall command is used to send a message to all logged-in users. Following is its syntax:

wall [-n] [-t TIMEOUT] [file]

And here’s how the tool’s man page describes it:

 Wall displays the contents of file or, by default, its standard input, on

the terminals of all currently logged in users. The command will cut over

79 character long lines to new lines. Short lines are white space padded

to have 79 characters. The command will always put carriage return and

new line at the end of each line.

Only the super-user can write on the terminals of users who have chosen

to deny messages or are using a program which automatically denies mes?

sages.

Reading from a file is refused when the invoker is not superuser and the

program is suid or sgid.

Following are some Q&A-styled examples that should give you a good idea on how the wall command works.

Q1. How to use wall command?

Basic usage is very straightforward – just execute the ‘wall’ command and write the message you want to transmit on the standard input. Once done, use the Ctrl D key combination to signal the command that you’re done writing the message.

wall

For example, here’s the first step when the text is entered on stdin:

<img alt="How to use wall command" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/wall-basic.png6380ba552c96a.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="37" loading="lazy" src="data:image/svg xml,” width=”380″>

Here’s the second step when Ctrl D is pressed multiple times, and the message is broadcasted:

<img alt="Using Linux wall command to inform users" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/wall-basic-2.png6380ba555a8c4.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="121" loading="lazy" src="data:image/svg xml,” width=”384″>

And here’s how other logged-in users see the message:

<img alt="Wall message as seen by the user" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/wall-broadcasted-msg.png6380ba559d16b.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="74" loading="lazy" src="data:image/svg xml,” width=”323″>

Q2. How to strip the header from the broadcasted message?

In case you want to remove the header that appears with the broadcasted messages, you can do that using the -n command line option.

wall -n

For example, the following action:

wall -n

Message without header

^D

Produced the following output:

<img alt="How to strip header from broadcasted message" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/wall-n-option.png6380ba55d7ea3.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="74" loading="lazy" src="data:image/svg xml,” width=”204″>

Q3. How to make wall accept input from file?

This can be achieved by passing the name of the file as input to the wall command.

wall [filename]

For example:

wall input.txt

Where input.txt contains the following line:

This message is from a file

<img alt="How to make wall accept input from file" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/wall-input-file.png6380ba562aada.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="38" loading="lazy" src="data:image/svg xml,” width=”461″>

And here’s the output:

<img alt="Wall output" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/wall-input-file2.png6380ba566faff.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="105" loading="lazy" src="data:image/svg xml,” width=”470″>

Q4. What are other ways to use wall command?

There exist some other ways as well in which you can use the wall command. For example:

echo "test message" | wall
wall << .

> test message

> .
wall <<< "test message"

Conclusion

To conclude, the wall command is a must-know if you are system/network admin, and most of your work involves managing headless servers that multiple users use. We’ve discussed most features of the wall command. To learn more, head to the tool’s man page. Also check out our cd command tutorial.