How to use the write command in Linux?

In Linux, the ‘write’ command is used to send a message to another user or terminal. The basic syntax is as follows:

write [username] [tty]

In this case, username refers to the username of the user sending the message, and tty refers to the terminal device number or terminal username. For example, to send a message to user1, you can use the following command:

write user1

Then, input the message you want to send and press Ctrl+D to end the input. The recipient will receive a message similar to the following:

Message from [your_username]@/[your_tty] on [current_time]...
[your_message]

Users who receive messages can reply using the write command.

bannerAds