UNIX provides many ways for users to communicate with each other. It allows you to send and receive information in text mode. You can transmit information to other users, all users, or yourself. The information source can be a text file or content directly input by the keyboard.
Write command
You can use the write utility to send a message to another user who has logged on. When the other party uses the write command, communication is established between the two parties.
When you use the write command, a prompt is displayed on the terminal of the other user. The format of the write command is as follows:
Write destination-user [terminal]
Destination-user is the registration name of the user you want to communicate with. Generally, use the who command to view the registration name. If the other party logs on to multiple terminals, you can use terminal to control the write packets sent to the specified terminal. To establish a two-way call with other users, the user and the other party must execute the write command each time and specify the registration name. Generally, when UNIX is used for a call, both parties have some conventions: "o" indicates that a message is ended, "oo" indicates that the communication is ended, and ctrl-d is used to exit the write command.
[Example 1] alex and jenny on UNIX can communicate with each other through the write command.
On the terminal where alex is located (that is, press Enter ):
$ Write alex
Hi Alex, are you there? O
Message from Alex (tty11) [Sat Jan 5]...
Yes Jenny, I'm here. o
......
Thank you, Alex, bye! Oo
Ctrl-d
$
This example illustrates how to use the write command to implement the communication between Alex and Jenny. First, Jenny sent a message to Alex using the first two lines. The next two lines are the packets sent by Alex. The ellipsis indicates that their communication continues. Finally, Jenny uses thank you, Alex, bye! Oo tells Alex that there is nothing to say. Then, press ctrl-d in the next line to exit write and return to shell.
Use talk
The talk command is a virtual communication command that allows the login parties to talk in real time through the keyboard. Its format is as follows:
Talk user-name [terminal] <CR> 〉
Note: The machine architecture used by both parties must be the same when talking to each other using talk. After the other party gives the response talk command, both terminals will display
[Connect established]
Both parties can communicate in duplex mode. Both parties can input at any speed from the keyboard, and talk will display one line of your input on the screen of you and the other party. Quit talk.
Use mesg to reject and allow receiving packets
The mesg command allows or rejects write and talk communication messages sent from other terminals. The mesg command is run on a local terminal in the following format:
Mesg [y] [n] <CR> 〉
Where, y indicates that the receiver is allowed, and n indicates that the receiver is rejected. If neither y nor n is given, the current license status is reported.
[Example 2] display status:
$ Mesg
The command execution result is:
Is y
Or is n
[Example 3] reject write and talk communication messages sent from other terminals:
$ Mesg n
$ Mesg
Is n
Wall broadcast message transmission
All login users can receive the message. This command is only used by Super Users. The wall command has the following formats:
# Wall
# Wall filename
# Wall "send a message to all the people ."
Log out (exit the UNIX System)
After each use, you must log out to prevent others from entering the system through your account and ensure system integrity. The logout process is as follows: run at the UNIX prompt:
$ Exit
Or
$ Logout
Or press the following button:
Ctrl + d.
Different UNIX operating systems may also have different logout commands.