How to send messages to logged on users in Linux.

Linux-LogoSome times it needs to send messages to the logged on users before doing a reboot or any update in Linux. After getting the message user can save their works before the reboot. Unless they will lose their work by the reboot. For this kind of job u needn’t require to install any kind of application/ tools on Linux. There is a command named “write” which enables you to do this. Syntax for the command

Now the question is how we can know that how many logged on users are there on the machine. For that we have to issue the below command:

and the out put should look like below:

If you want to send message to user2, issue following command at your terminal:

Now write the message you want. Press Ctrl+D to end the message. Your message would be sent.
If you want to send message to all users at a time then you have to use the command “wall”. The syntax is like below.

The length of the message is limited to 20 lines.

The following two tabs change content below.

Tapas Mishra

Sr. Engineer (DevOps)
Loves to work on Opensource products. Having experience on Linux environment. Knowledge on Public cloud services like AWS, Rackspace, DigitalOcean, Linode. Please don't hesitate to give a comment on the posts. Your comments are my strength.

Leave a Reply