Recently, I started using tmux; I'm trying to use the pair programming feature in that software. During the process a socket file was created. My question is: what are socket files, how am I to open them on Ubuntu and how are they used?

2 Answers 2


Sockets are a special file type, similar to TCP/IP sockets, providing inter-process networking protected by the file system's access control.

For example, when you open a listening socket in one terminal with netcat:

nc -lU socket.sock

then send data from another terminal by:

echo mytext | nc -U socket.sock

mytext appears on the first terminal.

By default nc stops listening after an End-of-File character.

  • I don't seem to have the U option with nc, I got an error U option not defined. Is socket.sock a file you created previously¿? Can you use tmux -S and use the socket file descriptor (tipicaly 3) from one of the ends of the socket to send data on that socket¿?
    – aDoN
    Apr 12, 2018 at 14:45
  • @aDoN install nc.openbsd, you have the nc.traditional.
    – Cuauhtli
    Dec 17, 2018 at 5:54
  • In Linux End-of-File is a condition, not a character. Aug 4, 2022 at 0:00

A unix domain socket is a bidirectional pipe similar to a TCP/IP socket. A server listens for and accepts connections from clients, and then can communicate with the client on the newly accepted connection. What is special about unix domain sockets is that instead of having an IP address and port number, they have a file name as their address. This allows other applications that know nothing about networking to be told to open the file and read or write and the data is sent to the server instead of to the disk.

  • 3
    What a simple and elegant idea!
    – iono
    Jul 1, 2019 at 12:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .