0

In ss command, when using the -p option, this presumably provides info about the process (owner, pid an fd)

root@Cassiopeia:~# ss -tap | tail -1
ESTAB     0       0           [2a0i:527:9981:8511:f64e:3774:982:ef80]:60966                             [2a02:1450:4001:81c::270e]:https                         users:(("firefox",pid=5684,fd=97))   

My question is what the fd stands for, given that a process may have many file descriptors associated with it

e.g.,

root@Cassiopeia:/proc# cd 5684
root@Cassiopeia:/proc/5684# cd fd
root@Cassiopeia:/proc/5684/fd# ls
0    104  109  114  119  125  13   135  14   145  150  156  162  169  174  180  20   206  239  28  32  37  41  46  50  55  6   64  69  73  78  82  87  91  96
1    105  11   115  12   126  130  136  140  147  152  158  163  17   175  184  201  21   24   29  33  38  42  47  51  56  60  65  7   74  79  83  88  92  97
10   106  110  116  122  127  132  137  142  148  153  159  164  170  178  19   202  22   25   3   34  39  43  48  52  57  61  66  70  75  8   84  89  93  98
100  107  112  117  123  128  133  138  143  149  154  16   166  171  179  199  204  23   26   30  35  4   44  49  53  58  62  67  71  76  80  85  9   94  99
103  108  113  118  124  129  134  139  144  15   155  161  167  172  18   2    205  233  27   31  36  40  45  5   54  59  63  68  72  77  81  86  90  95
  • 1
    The fd is the process-local file descriptor for the network connection displayed. – dsstorefile1 Sep 1 '18 at 11:07
  • If your question is, how do fd's (for a process) get assigned to files and sockets: except 0,1,2 which are usually provided by the parent process (shell, etc), the lowest available (not currently open) fd is assigned whenever needed by system calls like open creat pipe socket dup and probably more I forgot. So normally the first file or socket opened by the code gets 3, the next 4, the next 5, etc., but if you have say 0..87 open and close 81 42 and 63 because e.g. they were sockets whose connections ended, the next open gets 42. – dave_thompson_085 Sep 1 '18 at 12:39
  • yes but a process may have many (local) fds open and ss always displays one – pkaramol Sep 1 '18 at 13:48

Your Answer

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

Browse other questions tagged or ask your own question.