How to use wall command in linux

Introduction

wall (an abbreviation of write to all) is a Unix command-line utility that displays the contents of a computer file or standard input to all logged-in users. It is typically used by root to send out shutting down message to all users just before poweroff.

wall command

You can use wall command to Broadcasting a Message with the syntax below:

wall [OPTIONS] [File]
OR
wall [OPTIONS] [Message]

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

  • You can do that with invoke the wall command with the message as the argument as shown below:
wall "Attention please, The system will be restarted in 1 hour."

The message will be broadcasted to the users currently logged in.

  • To show only the text you types and disappear the banner, invoke the command with the -n  or (–nobanner) option
wall --nobanner "Attention please, The system will be restarted in 1 hour."
  • If you want to write multi-line messages, invoke the wall command, it will wait for you to finish your lines then you should press Ctr+D to end it then it will broadcast the message
wall
  • Here is an example showing how to use the echo command with wall on pipe to broadcast a message
echo "Attention please, The system will be restarted in 1 hour." | wall
  • Also you can broadcast a Message From a File
wall Attention_message.txt

It will display all the content of the file in addition to the broadcast banner message of wall command

  • Finally you can Broadcast a Message to a Group

So to send a message only to members of a given group, run the command with the -g or –group option, followed by the group name.

wall -g Devlopers "The system will be restarted in 1 hour."

Conclusion

That’s it

We illustrated how to use wall command to display a file content or standard input to all logged-in users on the system.

Qadry
unixcop Admin

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

You might also likeRELATED

How to Count Number of Files and Sub-directories inside a Directory

Hi guys, In this article we will show you how to count the number of files and sub-directories in a directory using a tree command. Count number...

Find Top 10 IP Addresses Accessing Your Apache Web Server

In this post, you will learn how to Find Top 10 IP Addresses Accessing Your Apache Web Server- The monitoring access to your web server...

How to Install MongoDB in CentOS 8

Introduction MongoDB is a source-available cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with optional schemas. MongoDB is developed by MongoDB Inc. and licensed under the Server Side Public License (SSPL). MongoDB is a...