Linux – lsof: What the numbers inside socket parentheses represent

lsof: What the numbers inside socket parentheses represent… here is a solution to the problem.

lsof: What the numbers inside socket parentheses represent

When I run the lsof command, in the name column, for sockets, some numbers appear in parentheses as shown below. What do you mean?

 command    pid        user      fd                 Name
 process    8197       root      29                 socket:[3050474]

Solution

TL;DR: A unique number associated with the socket


One of the defining rules of Unix is “Everything is a file”. Because sockets are also represented by very special file systems, often referred to as sockfs.

Files on traditional file systems have inode-numbers — unique numbers that allow them to be identified:

$ ls -li /bin/bash 
7864369 -rwxr-xr-x 1 root root 656584 Oct 15  2014 /bin/bash
^^^^^^^
inode-number

The same applies to Sockfs, all sockets also have inode-numbers.

For special file systems that do not have an actual file naming pattern, all files have a common name of the form fsname:[inode-number] (see also: linux+v3.19.1/fs/dcache.c#L2945)

Related Problems and Solutions