Steps of Sending Message to All Users in Linux

Complete Guide to Sending Message to All Users in Linux

In real life, the idea of sending a message to all has its adherent and dissentient. But in a Linux server, there is no disagreement since it is required to send messages to all users who are logged on. Sending Message to All Users in Linux is what we are going to teach in this article. Join us with this guide to see how you can use some related commands to leave messages to a local user in a Linux system. Also, if you are not a phone call person, this guide helps you stop apologizing to people for what you are and do your job easily.

A while after buying your Linux VPS, you might not be alone on it. You will need to communicate with other users and send messages to all or a particular logged-on users. Various commands will be explained and introduced in this guide to familiarize you with Linux facilities for sending messages to all users.

Sending Message to All Users in Linux Terminal

Let’s go through this tutorial to learn about the most used Commands that allow sending message to all users in Linux Ubuntu, Debian, CentOS and other distributions. Stay with us to learn which Command Lines help you to send messages to logged users in Linux.

1. wall Command

The wall command is the most used command by system administrators. It is used to send messages to all currently logged-in users in Linux. The write all command writes your considered message to all the local user accounts. Because of this, the system is likely a server and that command-line operations are taking place. The wall command can be used by any user, though typically sysadmins use it to warn users of information (such as that the server will be unavailable for maintenance) and to send out notices to users.

Here is the basic syntax of the wall command that is used for sending message to all users in Linux:

wall [OPTION] [message | file]

As we mentioned, this command is used for an important announcement from the administrator to other users. Let’s see an example:

# wall "System will go down for 3 hours maintenance at 10:00 PM"

utilize double quote marks to enclose your message if you want to utilize single quote marks, as in the following example:

$ wall ‘’Keep in mind to send your check lists before 02:00 PM’’

The outer quote marks won’t appear in the message that is sent. The command will still wait for a closing single quote if they are not there. When other local users open the terminal, they would see the message. If you use the wall command without specifying the message, stdin will read the message.

You can also disable the normal banner printed by the wall command. Consider the below command as an example:

Broadcast message from root@operavps (pts/2) (Mon Aug  28 11:52:09 2023) :

Add the -n (Suppress the banner) flag:

# wall -n "System will go down for 3 hours maintenance at 10:00 PM"

Note: The root user can only use this.

Additionally, the command needs superuser privilege in some Linux variations. For instance, you only need to run the wall command to broadcast the following message with superuser access:

$ sudo wall

Then, you are ready to send your message as a superuser by entering it in and pressing Ctrl + D. You can also use the wall command to transmit a message in a file. You just need to start by making the file in an editor like Vim for this.

$ vim message.txt

Next, include the message you want to deliver to other local users inside the file:

The system will shut down at 11:30 AM

You can now close the text editor after that. Finally, you will use the wall command and the filename:

sudo wall message.txt

In this way, the above command sends your message written in the file message.txt to all active users on the system.

2. write Command

As you learned so far, the wall command sends a message to all users who are currently logged in. The write command is more suited for this operation if you wish to leave a message for a specific user. The write command is pre-installed on all or nearly all Linux distributions. It enables you to utilize tty to communicate with another user in the terminal. Check all currently logged-on users first using the who command as demonstrated.

$ who

The output displays current active users on the system and any probable user who is sending a message to the root user.

$ write root pts/2	#press Ctrl+D  after typing the message. 

Or when the user Sara needs to send a message to a user Amanda, the command will be written with the username Amanda:

$ write amanda
Hey, amanda!
Is tomorrow your day off? 
^D

So that ^D  denotes Ctrl + D. To stop writing the message, push this combination.

This starts a conversation between the users and sends Amanda the first messages. Amanda’s terminal now displays anything Sara writes. To react, user Amanda would use the write command followed by their username:

$ write sidrah

Amanda continues by typing on the terminal what she wants to send to user Sara. Both users can press Ctrl + C to end the session. User Sara might wish to find out who is currently logged in since the write command only sends messages to logged-in users. They can do this by utilizing the who command:

$ who
sara tty2 2023-08-07 22:07 (tty2)
amanda tty3 2023-08-07 22:42 (tty3)

The users who are currently logged in will be shown in the output. On Linux computers, the message option is turned on by default. We would use the mesg command with the n argument to cease receiving unwanted messages from any local user. So, the mesg command can be used to prevent messages from other users from reaching you if you decide for some reason not to accept them. This command can be used with the “n” parameter to deny the user’s mail or the “y” option to permit the messages to get through.

$ mesg n

It prevents all incoming messages. You can utilize the y option to re-enable messaging:

$ mesg y

The user who has been blocked won’t be informed that their messages have been stopped.

3. talk Command

The talk command in Linux can be used to communicate with numerous local users. The talk or ytalk command will open a window with top and bottom panes. Each person will type into the top section of the display on their screen, and the bottom section(s) will show the responses. When asked to talk, the respondents can do so by typing “talk” and the user name of the person addressing them. If ytalk is utilized, the window can have more than two participants.

Since the talk command is not installed by default in Linux, you need to employ the apt package manager to install it in Ubuntu or Debian:

$ sudo apt-get install talk
$ sudo apt-get install talkd

On CentOS or Fedora:

$ sudo yum install talk
$ sudo yum install talk-server

For instance, the command would be as follows if you wanted to communicate with user Amanda on the Ubuntu system:

$ talk amanda@ubuntu
Message from sara@ubuntu
talk: connection requested by amanda@ubuntu
talk: respond with: talk amanda@ubuntu

When responding to this, the user Amanda would use the talk command and the following username:

$ talk sara@ubuntu

By pressing Ctrl + C, the user can close the chat window. The chat session ends as a result.

In the case of requirement, add the -h option and the hostname or IP address to a command like this to communicate with someone on a different system:

$ talk -h IP Address opera

At this point introducing commands for Sending Message to All Users in Linux is finished. As you reviewed, it was really easy.

Conclusion

In this article, Sending Message to All Users in Linux using Command Line was explained. Now, you know that you can use the wall, write, and talk commands to send messages to users in Linux. Also, you learned

While the fundamental commands we can use in Linux to leave a message for another user are wall, write, and talk, each has a unique feature set.

If you use the explained commands, Sending Messages All Users in Linux would be done without any errors but do not hesitate to contact us if you encounter any problems. Our technical support team will try their best to solve your problems. Also, if you know any other commands that we did not discuss, then the comment section is all yours.

Related Article : What is Debian OS

Leave a Reply

Your email address will not be published. Required fields are marked.