Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to create a new socket file in /dev. Does the way to get it is adding a new rule to udev?

share|improve this question
up vote 8 down vote accepted
  • The usual way to create a Unix domain or TCP socket is programatically, via the mknod or socket system calls. The mknod command will not allow you to create a socket.

From the command line, use the socket package

  • If you wish to create a Unix/TCP socket from the command-line, try the socket command from the socket package (install it first). Summarizing its man page description:

    Socket creates an Internet domain TCP or a UNIX domain stream socket and connects it to stdin and stdout.

Examples of socket usage (from man page)

  1. socket -v nntp

    connects to the nntp port (port 119) of (

  2. socket -sl 3425

    creates a server socket on port 3425 on the local host and waits for a connection. After a connection has been closed, a new connection is accepted.

  3. socket -wslqvp "echo Socket! " 1938

    creates a server socket on port 1938 on the local host and waits for a connection. When a connection is accepted, the string "Socket!" is written to the socket. No data is read from the socket and written to the finger program. The connection is closed when an end-of-file condition at the standard output of the program occurs. Then a new connection is accepted.

share|improve this answer
Have you any idea how you would create the equivalent of /dev/log with the socket command? – Robin Winslow Nov 15 '14 at 18:59

I think your looking for the command mknod. (If you're interested in the system call it uses, here's the manpage for that.)

share|improve this answer

You cannot create it, but you can copy from a working system as below to some shared location between the machines and copy from the shared location to the other system.

Machine A

cp -rf /dev/SRC shared_directory

Machine B

cp -rf shared_directory /dev/
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.