15

For a socket file likes this:

# ls -alti socket
14112 srw------- 1 root root 0 Nov 15 20:03 socket
# cat socket
cat: socket: No such device or address

Since cat command is useless here, is there any method to get more info about the socket file? Such as which port it is listening on? etc.

  • 2
    Only TCP and UDP sockets have the concept of port, or to be more precise, unix socket domains do not have associated ports. – Rui F Ribeiro Nov 16 '15 at 8:50
6

A socket is a file for processes to exchange data. You can see more data about it using the netstat, lsof, and fuser commands.

From Wikipedia:

A Unix domain socket or IPC socket (inter-process communication socket) is a data communications endpoint for exchanging data between processes executing on the same host operating system. Like named pipes, Unix domain sockets support transmission of a reliable stream of bytes (SOCK_STREAM, compare to TCP).

| improve this answer | |
  • So socket file is just a UNIX domain socket? – Nan Xiao Nov 16 '15 at 9:09
  • Exactly, it was what I tried to convey. – Rui F Ribeiro Nov 16 '15 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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