How to Communicate with Other Users on the Linux Command Line

How to Communicate with Other Users on the Linux Command Line

It's easy to send messages to other users in the Linux command line. There are many commands that can do this, but the trouble is that you need to choose a suitable command to use from among the many commands. Therefore, I have selected four commonly used Linux user communication commands to share with you and explain to you how these four commands work.

wall

The wall command (which stands for write all) allows you to send messages to all users logged in on the system. Any user can use the wall command, but the wall command is usually used by system administrators to send announcements to users (for example, the server will be shut down for maintenance).

A system administrator might send a message like this:

$ wall The system will be going down in 15 minutes to address a serious problem

All logged in users will then see a notification similar to this:

Broadcast message from admin@dragonfly (pts/0) (Thu Mar 5 08:56:42 2020):
The system is going down in 15 minutes to address a serious problem

If the message you want to send contains single quotes, you need to enclose the message in double quotes, as shown below:

$ wall "Don't forget to save your work before logging off"

In the command shown in the example above, the outermost quotation marks will not be displayed when the information is transmitted, but if there is no outermost quotation mark, this command will be executed and will wait for a quotation mark that matches the single quotation mark in the sentence to end the sentence.

mesg

If for some reason you want to reject messages from a certain user, you can use the mesg command. This command should be used with the parameter n or y, which means rejecting or accepting a user's email respectively. The following is an example (alvin is the user name):

$ mesg n alvin
$ mesg y alvin

It is worth noting that after using the mesg command to block a user, the blocked user will not receive a notification that he or she has been blocked. In other words, the blocked user will not know that he or she has been blocked.

You can also use this command to accept or block communications from all users by omitting the username parameter:

$ mesg y
$ mesg n
write

Another command that can send a text message directly without converting it to an email is write. This command can be used to communicate with a specific user. For example, if you want to send a message to a user named alvin, you can use the following command:

$ write alvin
Are you still at your desk?
I need to talk with you right away.
^C

After writing and sending the message, press ctrl+C to exit. This command allows you to send messages, but does not open a duplex channel; it can only be used to send messages. If the receiving user is logged in on more than one terminal, you can select the terminal you want to transfer to or rely on the system to select the terminal that takes the least time to transfer, as shown below:

$ write alvin#1

If you are blocked by user alvin, you will see the following message:

$ write alvin
write: alvin has messages disabled
talk / ytalk

The talk and ytalk commands allow you to establish interactive communication with one or more users, while the talk command only allows you to establish interactive communication with one user. Both the talk and ytalk commands start a two-pane window. Each party in the communication can enter information in the upper pane of the window and see the response information in the lower pane.

The party being asked to join the communication can respond by typing talk followed by the user name of the party initiating the communication, as shown below:

Message from Talk_Daemon@dragonfly at 10:10 ...
talk: connection requested by [email protected].
talk: respond with: talk [email protected]
$ talk alvin

It is worth noting that when both talk and ytalk are installed on the system, the talk command will be associated with the ytalk command by default, so when you enter talk alvin, the system actually executes ytalk alvin. Since both commands are installed on my system, the output I see after executing the above command is actually that of ytalk alvin:

----------------------------= YTalk version 3.3.0 =--------------------------
Is the report ready?
-------------------------------= root@lxlinux =----------------------------
Just finished it

The above is the window information seen by user alvin, while the window content seen by root on the other end of the communication is the opposite:

----------------------------= YTalk version 3.3.0 =--------------------------
Just finished it
-------------------------------= alvin@lxlinux =----------------------------
Is the report ready?

Likewise, this command can be terminated with ctrl+C.

To use this command to communicate with users on other systems, you need to add the -h parameter, where the parameter value is the host name or IP address. Its use cases are as follows:

$ talk -h 192.168.0.11 alvin

Summarize

The Linux system has many commands that can be used to send information to logged-in users. These commands are very useful in some scenarios, such as using wall to broadcast information and using talk to conduct interactive conversations between two users. They both allow users to exchange information quickly. Learning to use these common commands can make communication between users more convenient and improve communication efficiency.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • How to view and execute historical commands in Linux
  • Teach you to hide Linux command line history
  • Shell history command recording function in Linux
  • There is no make command in Linux (make: *** No target specified and no makefile or make command installation method found)
  • Use of Linux telnet command
  • Linux gzip command compression file implementation principle and code examples
  • Detailed explanation of how to adjust Linux command history

<<:  Details of 7 kinds of component communication in Vue3

>>:  Solution to MySQL IFNULL judgment problem

Recommend

Vue implementation example using Google Recaptcha verification

In our recent project, we need to use Google robo...

Tutorial on installing and using virtualenv in Deepin

virtualenv is a tool for creating isolated Python...

Can MySQL's repeatable read level solve phantom reads?

introduction When I was learning more about datab...

Three ways to implement animation in CSS3

This is a test of the interviewee's basic kno...

Solution to forgetting the root password of MySQL 5.7 and 8.0 database

Note: To crack the root password in MySQL5.7, you...

How to use limit_req_zone in Nginx to limit the access to the same IP

Nginx can use the limit_req_zone directive of the...

Tutorial on installing mysql5.7.23 on Ubuntu 18.04

This article shares with you the specific method ...

Summary of basic knowledge and operations of MySQL database

This article uses examples to explain the basic k...

Recommend several MySQL related tools

Preface: With the continuous development of Inter...

WeChat applet calculator example

This article shares the specific code of the WeCh...

How to install mysql on centos and set up remote access

1. Download the mysql repo source $ wget http://r...

Vue implementation counter case

This article example shares the specific code of ...

SSM VUE Axios Detailed Explanation

Table of contents How to display SQL log? ? Descr...