In Linux, there are commands like write/wall which are used to communicate with other users especially by system administrators to send a short message to all logged-in users. There is one more command talk which is like an instant messenger service that enables two users to chat. In this article, we will discuss this command and the various ways to connect with other users.
Syntax:
Usage: talk user [-x] [ttyname]
user - user's login name.
-x - talk with user who has dot character in username.
ttyname - talk with user who has logged in more than once using the terminal name.
Installation of talk command:
For Ubuntu/Debian :
sudo apt-get install talk
sudo apt-get install talk-server
For CentOS/Fedora :
sudo yum install talk
sudo yum install talk-server
Configuration:
- Create two files named talk and ntalk under /etc/xinetd.d/ directory.
- Edit talk file as below,
# default: off
# description: The talk server accepts talk
# requests for chatting with users \
# on other systems.
service talk
{
flags = IPv4
disable = no
socket_type = dgram
wait = yes
user = nobody
group = tty
server = /usr/sbin/in.talkd
}
- Next edit ntalk file as below,
# default: off
# description: The ntalk server accepts
# ntalk connections, for chatting \
# with users on different systems.
service ntalk
{
flags = IPv4
disable = no
socket_type = dgram
wait = yes
user = nobody
group = tty
server = /usr/sbin/in.ntalkd
}
- Then restart xinetd service.
Working with talk command
Whenever talk command is issued, it will contact the talk-daemon on the other user’s terminal and send the below message to that user,
Message from TalkDaemon@his_machine...
talk: connection requested by your_name@your_machine.
talk: respond with: talk your_name@your_machine
Now, other users can respond by typing
talk your_name@your_machine
The talk command works by copying lines from one terminal to that of the terminal used by another user. It splits the window into 2 panes (top and bottom) wherein user can type in the top pane and the response would be seen in the bottom pane in another terminal. It can be used to
1) To communicate with users on the same host or on the different host,
talk <username> => local user
talk username@hostname or talk username@ip_address => remote user
Talk daemon first checks if the user has logged in. If not, it will report that the user is not logged on and wait for the user to connect.
Once the user is logged-in, it will send a message and wait for the response from that user.
If there is no response, then the daemon will continuously send message to that user.
Once the destined user connects, the connection will be established and both can chat now.
Pressing Ctrl+c will terminate the connection.
2) To talk with the user who has a dot character in username, then have to use the -x argument.
talk <user_name> -x
3) If the user has logged in more than once, then the terminal name can be used to connect with that user.
talk <user_name> <tty> => talk root pts/17
If the user does not want to receive talk requests, then it can be blocked using the mesg command. Thus using the talk command we have understood various ways to connect with another user. For more information, please refer “man talk”.
Similar Reads
Telnet Command in Linux
Telnet serves as a command line interface (CLI) tool that allows logging in and communication with a system through a TCP/IP network. Users can issue commands on a remote machine as Telnet users can log into a machine over a TCP/IP network with the use of Telnet addresses (e.g. telnet://user@hostnam
7 min read
Fun Commands in Linux
Linux isn't just for coding and administrationâit can also be a lot of fun. With a variety of terminal commands, you can add some entertainment to your Linux experience. Below is a list of some cool and fun commands you can use in Linux to enhance your terminal experience. Weâll also cover how to in
4 min read
Linux Commands
Linux commands are essential for controlling and managing the system through the terminal. This terminal is similar to the command prompt in Windows. Itâs important to note that Linux/Unix commands are case-sensitive. These commands are used for tasks like file handling, process management, user adm
15+ min read
Shell Scripting - Talk Command
The use of Shell scripting can simplify repetitive tasks and enable more complex operations with minimal code. Shell commands vary in syntax, with "talk" being a command to facilitate communication among users within the same network. Proper knowledge of the shell, OS, and available commands is nece
6 min read
Linux Commands Cheat Sheet
Linux, often associated with being a complex operating system primarily used by developers, may not necessarily fit that description entirely. While it can initially appear challenging for beginners, once you immerse yourself in the Linux world, you may find it difficult to return to your previous W
13 min read
write command in Linux with Examples
The `write` command in Linux facilitates the users in sending the messages directly to other logged-in users' terminals. For using this command, try on to type `write username` and then type your message. After typing your message, press `Ctrl+D` to end the session. This command is useful for quick
6 min read
uname command in Linux with Examples
Linux, renowned for its open-source flexibility and powerful performance, offers a range of commands that reveal the inner workings of your system. Among these, the 'uname' command stands out as a versatile tool that provides key details about your Linux machine. Here, we will learn the basics of th
4 min read
Basic CentOS Linux Commands in linux
CentOS is a free and open-source operating system that aims to provide a stable reliable, and community-supported platform for servers and other enterprise applications. In this article, we will be covering CentOS Linux basics commands and functions of CentOS and also we will look into the advanced
3 min read
ipcrm command in Linux with examples
ipcrm command in Linux is used to remove some IPC(Inter-Process Communication) resources. It eliminates the IPC objects and their associated data structure form the system. One must be a creator or superuser or the owner of the object in order to remove these objects. There are three types of System
2 min read
lsmod command in Linux with Examples
lsmod command is used to display the status of modules in the Linux kernel. It results in a list of loaded modules. lsmod is a trivial program which nicely formats the contents of the /proc/modules, showing what kernel modules are currently loaded. Syntax: lsmod Example: Run lsmod at the command lin
1 min read