How to Use the wall Command in Linux

Introduction

The wall command in Linux is a useful tool for sending messages to all logged-in users on a system. It is a simple command that can be used to broadcast messages to all users on a system, or to a specific user. This guide will explain how to use the wall command in Linux, and provide some examples of how it can be used.

How to Use the wall Command in Linux

The wall command is a Linux utility used to send a message to all logged-in users on a system. It is useful for system administrators to broadcast important messages to all users.

To use the wall command, open a terminal window and type the following command:

wall [message]

Replace [message] with the message you want to broadcast. For example, to broadcast the message “System maintenance in progress”, type:

wall System maintenance in progress

Press Enter to send the message. All logged-in users will receive the message in their terminal window.

Introduction

Scenarios in which multiple users use SSH to work on a server simultaneously are common in the Linux world. When system administrators perform system maintenance tasks, they need a quick way to inform users they should save their work and log out.

In this tutorial, you will learn how to use the wall command in Linux. This command allows sending terminal messages to all logged in users at once.

How to Use the wall Command in Linux

Note: wall is a terminal-based command. Users working in a GUI without a terminal window open will not see wall notifications.

Prerequisites

  • A system running Linux
  • Access to the command line

What Does the wall Command Do?

wall is short for write to all. The purpose of the command is to send a quick message to the terminals of all currently logged in users.

Linux wall Command Syntax

The syntax of wall is straightforward. The command is followed by options and either the text of the message or a filename:

wall [options] [message-text/filename]

wall Command Examples

Below is a list of all the options wall takes, along with examples of the command use.

Broadcast a Message

The basic way to use the Linux wall command is to type it before a message you want to send, without any added options.

wall [message-text]
Sending a message to logged-in users using the wall command

The users receive the message in the following format:

The look of the message send with the wall command in the user terminal

Note: Use the wall command sparingly. It was designed for communicating essential pieces of information, so it reaches all the logged in users under all conditions. Frequently using the command when there is no need for it may disrupt the workflow for some users.

Add a Timeout to a Message

If the contents of the message become irrelevant after a certain period, use the -t (--timeout) option to limit the time during which the system attempts to deliver the message:

wall -t [time-in-seconds] [message-text]
Using the -t option with the wall command to create an expiring message

Users who log in after the allotted time expires do not receive the message.

Broadcast a Message Without the Header

To exclude the header text preceding the message, use the -n (--nobanner) option:

wall -n [message-text]
Sending a message to logged-in users using the wall command with the -n option to remove the header

The system now displays only the contents of the message:

The look of the message sent with the wall -n command in the user terminal

Write Multi-line Messages

1. To write a message containing multiple lines, type the wall command and press Enter. The terminal provides the user with space to enter the message.

2. Once you finish writing, press Ctrl+D to end the input and send the message.

wall 

[message-line-1]

[message-line-2]…

Sending a multiple-line message using the wall command

The system displays the multi-line message on the users’ screens:

Receiving a multiple-line message send with the wall command

Broadcast a Message from a File

To use text contained in a file as the wall message, write the filename after the wall command:

wall [filename]

The output for the users receiving the message looks the same as in the previous examples:

Receiving a message sent with the wall command using a text file

Broadcast a Message to a Group

Limit the reach of the wall command to include only a certain group of users by using the -g (--group) option:

wall -g [group-name] [message-text]
Sending a message to members of a group using the wall command with the -g option

In the example above, only the users belonging to testgroup receive the message.

Use the wall Command with echo

Another way to send a message using wall is to pipe the output of  the echo command into wall using the following syntax:

echo "[message-text]" | wall

Display Version Information and Help

Use the -V (--version) option to see the installed wall utility’s version information:

wall -V

The -h (--help) option lists all wall command options:

wall -h

Conclusion

After reading this tutorial, you should understand how to use the wall command in Linux. The tutorial covered all available options and offered practical examples of using the command.

How to Use the wall Command in Linux

The wall command is a Linux utility that allows users to send messages to all logged-in users on a system. It is a useful tool for system administrators to broadcast important messages to all users on the system. In this article, we will explain how to use the wall command in Linux.

Using the wall Command

The wall command is a simple command-line utility that can be used to send messages to all logged-in users on a system. To use the wall command, simply type the following command in the terminal:

wall [message]

Where [message] is the message you want to send. For example, to send a message to all logged-in users, you can use the following command:

wall "This is an important message!"

This will send the message “This is an important message!” to all logged-in users on the system. The message will be displayed on the user’s terminal.

Options for the wall Command

The wall command has a few options that can be used to customize the message. These options are as follows:

  • -n: This option allows you to specify the sender of the message. For example, if you want to specify the sender as “root”, you can use the following command:
    wall -n root "This is an important message!"
  • -t: This option allows you to specify the time in seconds before the message is displayed. For example, if you want to display the message after 10 seconds, you can use the following command:
    wall -t 10 "This is an important message!"

Conclusion

In this article, we have explained how to use the wall command in Linux. The wall command is a useful tool for system administrators to broadcast important messages to all users on the system. We have also discussed some of the options that can be used to customize the message.

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Jassweb.com/

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.

Contact
San Vito Al Tagliamento 33078
Pordenone Italy
Item added to cart.
0 items - 0.00
Open chat
Scan the code
Hello 👋
Can we help you?