How to use the write command in Linux using practical Examples ?

Linux

The write command in Linux is a command-line utility that is used to send messages to other users who are currently logged in to the same system. This command allows the user to communicate with other users on the system, as well as to send files, pictures, and other information.

Here at Fixwebnode , we shall look into how to use the Write command in Linux.

 

Using the write Command

Using the write command is simple. To use the command, first you must know the username of the user you wish to message. You can then type the following in the terminal:

$ write username
	
	

Once you have entered this command, the Terminal will ask for a message to be entered. You can type in your message, hit enter, and the message will be sent to the user you specified.

In order to exit from the write session, type the following in the Terminal:

Ctrl + D
	
	

 

Write Command Options

The write command has several options that can be used to modify the command. Here are some of the most commonly used options :

  • -n: This option is used to specify a specific user to message.
  • -f: This option is used to specify a file to send.
  • -m: This option is used to specify the message to be sent.
  • -s: This option is used to set the size of the message.

 

Examples of using write command 

1. Sending a Message

To send a message to another user, use the command in the following format:

$ write [username]
	
	

This will open up a new window in which you can type the message that you would like to send. When you are finished, press Ctrl + D to send the message. The other user will receive the message in their terminal window.

 

2. Setting a Time Limit

If you would like to set a time limit on the message, use the -t flag. For example:

$ write -t [username] [time limit]
	
	

This will send the message with a time limit of the specified amount of minutes. If the other user doesn't read the message within the time limit, it will be automatically deleted.

 

3. Setting a Message Limit

You can also set a message limit using the -l flag. This will limit the amount of characters that the other user can type in the message window. For example:

$ write -l [username] [message limit]
	
	

This will limit the other user to the specified number of characters. If the user exceeds the message limit, the message will be automatically deleted.

 

4. Sending a Message to Multiple Users

You can also send a message to multiple users at the same time. To do this, use the -m flag. For example:

$ write -m [username1] [username2] [username3]
	
	

This will open up a new window in which you can type the message that you would like to send. When you are finished, press Ctrl + D to send the message to all of the specified users.

 

[Need help in fixing Linux issues ?  We can help you . ]


Conclusion

 

This article covers the write command which is a useful command-line utility that can be used to send messages to other users who are currently logged in to the same system. By using the command's variou

Your Cart