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
Linux/Unix Tutorial Linux is one of the most widely used open-source operating systems. It's fast, secure, stable, and powers everything from smartphones and servers to cloud platforms and IoT devices. Linux is especially popular among developers, system administrators, and DevOps professionals.Linux is:A Unix-like OS
10 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
25 Basic Linux Commands For Beginners [2025] While performing a task, we all need shortcuts. Shortcuts help us to complete a task quickly. Linux comes with such commands which are one to two words, using that commands, you can perform several operations in no time. As a beginner, you must be aware of those basic Linux commands to complete an o
13 min read
grep command in Unix/Linux The grep command is one of the most useful tools in Linux and Unix systems. It is used to search for specific words, phrases, or patterns inside text files, and shows the matching lines on your screen. Syntax of grep Command in Unix/LinuxThe basic syntax of the `grep` command is as follows:grep [opt
6 min read
Sed Command in Linux/Unix With Examples The SED command (short for Stream Editor) is one of the most powerful tools for text processing in Linux and Unix systems. It's commonly used for tasks like search and replace, text transformation, and stream editing.With SED, you can manipulate text files without opening them in an editor. This mak
8 min read
AWK command in Unix/Linux with examples Awk is a scripting language used for manipulating data and generating reports. The awk command programming language requires no compiling and allows the user to use variables, numeric functions, string functions, and logical operators. Awk is a utility that enables a programmer to write tiny but eff
8 min read
Introduction to Linux Shell and Shell Scripting If we are using any major operating system, we are indirectly interacting with the shell. While running Ubuntu, Linux Mint, or any other Linux distribution, we are interacting with the shell by using the terminal. In this article we will discuss Linux shells and shell scripting so before understandi
8 min read
How to Find a File in Linux | Find Command The find command in Linux is used to search for files and directories based on name, type, size, date, or other conditions. It scans the specified directory and its sub directories to locate files matching the given criteria.find command uses are:Search based on modification time (e.g., files edited
9 min read
ZIP command in Linux with examples In Linux, the zip command compresses one or more files or directories into a single.zip archive file. This saves disk space, keeps data organized, and makes it simple to share or backup files. It's among the most used compression utilities, particularly when sharing large files via email or storing
6 min read
What is Linux Operating System The Linux Operating System is a type of operating system that is similar to Unix, and it is built upon the Linux Kernel. The Linux Kernel is like the brain of the operating system because it manages how the computer interacts with its hardware and resources. It makes sure everything works smoothly a
13 min read