Using wall command in Linux

The wall command in Linux is used to display a message in the terminal of all the users who are currently login into a system. The wall stands for write all, for sending a message to a specific user write command is used. This command is helpful especially if there are multiple users are login into a server and the system admin wants to perform some maintenance task then he can drop a message to all the user to save and close the programs that they are open.

In this article, we will discuss the usage of the wall command on a Linux system along with some examples.

The syntax of wall command in Linux

The wall command has the following syntax on a Linux system –

wall [options] [file | message]

You can find the options that can be used with this command on the wall command’s man page. Where you can pass a file name or message which is to be displayed on a user’s terminal. If no file name or message specified then the wall command will read the message from standard input.

Example of wall command in a Linux system

The most basic use of the wall command is to write a message that you want to broadcast with the wall command. You can see the command which is given below –

wall "Please save your work... the system will restart in 10 minutes"

If you want to type a multiline message then simply run the wall command without any argument.

wall

and then start typing your message when done press ctrl+d to broadcast the message.

If you want to provide the message which is saved in a file then you can do this by passing the filename as the argument to the wall command. You can see the complete command which is given below –

wall message.txt

How to suppress the banner from the broadcasted message

You can use the option -n or --nobanner to remove the header that appears with the broadcasted message. See the command below –

wall -n "System will restart in 10 minutes..."

This will display the message without a header.

How to broadcast a message to a specific group

You can broadcast a message to a specific group on a Linux system. To send the message to only the member of a group you can use the option -g or --groupfollowed by the group name.

For example –

wall -g dev "The system will restart in 10 minutes.."

This message will be broadcasted to the members of the group dev on the system.

Conclusion

This is how you can use the wall command in Linux. To know more about this command see its man page in your terminal. Now if you have a query then write us in the comments below.

Leave a Comment