Learn the Linux Command - talk

Talk invokes a two-way chat through a shell session

crowd forming a speech bubble

Henrik Sorensen / Stone / Getty Images

Talk is a visual communication program for Linux shells that copies lines from your terminal to that of another user.

It's not often installed by default on distributions intended for stand-alone, home use, but it's available for installation through your package-management system.


Use the general form:

talk <person> <ttyname>

If you wish to talk to someone on your own machine, then person is just the person's login name. If you wish to talk to a user on another host, then person is of the form user@host.

If you wish to talk to a user who is logged in more than once, the ttyname argument may be used to indicate the appropriate terminal name, where ttyname is of the form `ttyXX' or `pts/X'

When first invoked, talk contacts the talk daemon on the other user's machine, which sends the message

Message from TalkDaemon@his_machine...
talk: connection requested by your_name@your_machine.
talk: respond with: talk your_name@your_machine

to that user. At this point, he then replies by typing

talk your_name@your_machine

It doesn't matter from which machine the recipient replies, as long as his login name is the same. Once communication is established, the two parties may type simultaneously; their output will appear in separate windows. Typing Ctrl+L reprints the screen. The erase, kill-line, and word-erase characters (normally Ctrl+H, Ctrl+U, and Ctrl+W respectively) behave normally. To exit, just type the interrupt character (normally Ctrl+C); talk then moves the cursor to the bottom of the screen and restores the terminal to its previous state.

As of netkit-ntalk 0.15, talk supports scrollback; use Esc+P and Esc+N to scroll your window, and Ctrl+P and Ctrl+N to scroll the other window. These keys are now opposite from the way they were in 0.16; while this change will probably be confusing at first, the rationale is that the key combinations with escape are harder to type and should therefore be used to scroll one's own screen, since one needs to do that much less often.

If you do not want to receive talk requests, you may block them using the mesg command. By default, talk requests are normally not blocked. Certain commands, in particular nroff, pine, and pr, may block messages temporarily in order to prevent messy output.