[email protected]Support 24/7 · Billing 09:00 – 00:00LinkedInXFacebook
NexonHost
Netherlands Dedicated ServersAmsterdam · Equinix AM6Germany Dedicated ServersFrankfurt · Equinix FR4Romania Dedicated ServersBucharest · VoxilityAustria Dedicated ServersVienna · Interxion VIEBulgaria Dedicated ServersSofia · TelepointFrance Dedicated ServersParis · Interxion PAR — Marseille · Digital Realty MRS3Ireland Dedicated ServersDublin · Equinix DB2Italy Dedicated ServersMilan · Irideos AvalonPoland Dedicated ServersWarsawSpain Dedicated ServersMadrid · Equinix MD2United States Dedicated ServersAshburn · Equinix DC
All articles
Getting startedAugust 10, 2023

How to use talk command.

What is talk command?

The talk command in Linux is a utility that allows two users to have a real-time text-based conversation over a network. It provides a simple and interactive way to communicate with another user who is logged into the same system or a remote system.

  • talk is a command-line tool that is typically used in Unix-like operating systems, including Linux.
  • It operates using the client-server model, where one user initiates the conversation by sending an invitation to another user.
  • Once the invitation is accepted, both users can type and send messages to each other in real-time, similar to a chat or instant messaging system.
  • talk uses the Terminal or console interface for communication, with each user’s messages appearing on the screen.
  • It allows for a one-on-one conversation between two users, with each message displayed in a separate window.
  • The talk utility uses the User Datagram Protocol (UDP) or the Stream Control Transmission Protocol (SCTP) for communication.
  • By default, users can only initiate a talk session with other users who are logged into the same system. However, it is possible to configure the system to allow talk sessions between remote systems.
  • To start a talk session, you would typically use the following syntax:

Syntax:

talk <username>
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 /root 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.

  1. To talk with the user who has a dot character in username, then have to use the -x argument.
talk <user_name> -x
  1. 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.

Keep reading
How to Add and Delete Users on CentOS 7.
June 12, 2023

How to Add and Delete Users on CentOS 7.

How To Add And Delete Users On CentOS 7. In this tutorial, we will explain how to add and remove users on CentOS 7 systems. How To Add User in CentOS In CentOS, you can create a new user account using the useradd command-line utility. To create a new user account named “username” you…

Read article
How To Secure Nginx with Let’s Encrypt on CentOS 7.
June 8, 2023

How To Secure Nginx with Let’s Encrypt on CentOS 7.

How To Secure Nginx With Let’s Encrypt On CentOS 7. Let’s Encrypt is a new Certificate Authority (CA) that provides a way to obtain and install free TLS/SSL certificates, thereby enabling encrypted HTTPS on web servers. It streamlines the process by providing a software client, Certbot, that…

Read article
How to use ls command.
June 1, 2023

How to use ls command.

How To Use Ls Command. This article will show you how to use the ls command through practical examples and detailed explanations of the most common ls options. ls is one of the basic commands that any Linux user should know. The ls command lists files and directories within the file system, and…

Read article
Get in Touch

Together, Let’s Build a Faster, Safer Internet.

Build scalable infrastructure with NexonHost — high-performance dedicated servers, VPS hosting, cloud hosting, and DDoS protection across Europe.

Get Started →Contact Us
[email protected]Support 24/7 · Billing 09:00 – 00:00