10

Is there a way to list pipes used by a running linux process (e.g. given its pid or process name) and to determine their used capacity?

Something like:

lspipes -l -p pid

resulting in something like:

[rw]  descriptor  size  name

where rw is the pipe end type and size is its used capacity

Or something similar

user123456
  • 364
  • 1
  • 3
  • 16
a1an
  • 3,526
  • 5
  • 37
  • 57

2 Answers2

16

1) ls -l /proc/pid/fd

This will list the pipes

lr-x------ 1 prabagaran prabagaran 64 Sep  5 23:01 14 -> pipe:[57729]
l-wx------ 1 prabagaran prabagaran 64 Sep  5 23:01 15 -> pipe:[57728]
lr-x------ 1 prabagaran prabagaran 64 Sep  5 23:01 16 -> pipe:[57731]
lr-x------ 1 prabagaran prabagaran 64 Sep  5 23:01 17 -> pipe:[57730]

2) lsof | grep 57731

wineserve 3641 prabagaran   76w     FIFO        0,8       0t0   57731 pipe
winedevic 3651 prabagaran   16r     FIFO        0,8       0t0   57731 pipe

These are the pipe information related to the given process id.

Gustav Larsson
  • 8,199
  • 3
  • 31
  • 51
Prabagaran
  • 903
  • 1
  • 9
  • 17
3

I don't really think there's such a command. You can try the following:

lsof -p <PID> | grep "FIFO"

Where <PID> stand for the process id. Probably there's a lsof switch to select only pipes and avoiding the grep, but I cannot find it in the man page right now.

It should give you something close to what you're looking for.

Iain Samuel McLean Elder
  • 19,791
  • 12
  • 64
  • 80
Zagorax
  • 11,440
  • 8
  • 44
  • 56