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?
有没有办法列出正在运行的linux进程使用的管道(例如,给定它的pid或进程名称)并确定它们的已用容量?
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
其中rw是管端类型,大小是其使用容量
Or something similar
或类似的东西
2 个解决方案
#1
11
1) ls -l /proc/pid/fd
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
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.
这些是与给定进程ID相关的管道信息。
#2
2
I don't really think there's such a command. You can try the following:
我真的不认为有这样的命令。您可以尝试以下方法:
lsof -p PID | grep FIFO
lsof -p PID | grep FIFO
Where PID stand for the process id, while FIFO stands for... nothing. You have to write exactly "FIFO". 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.
PID代表进程ID,而FIFO代表......什么都没有。你必须准确写“FIFO”。可能有一个lsof开关只选择管道和避免grep,但我现在无法在手册页中找到它。
It should give you something close to what you're looking for.
它应该给你一些接近你正在寻找的东西。
#1
11
1) ls -l /proc/pid/fd
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
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.
这些是与给定进程ID相关的管道信息。
#2
2
I don't really think there's such a command. You can try the following:
我真的不认为有这样的命令。您可以尝试以下方法:
lsof -p PID | grep FIFO
lsof -p PID | grep FIFO
Where PID stand for the process id, while FIFO stands for... nothing. You have to write exactly "FIFO". 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.
PID代表进程ID,而FIFO代表......什么都没有。你必须准确写“FIFO”。可能有一个lsof开关只选择管道和避免grep,但我现在无法在手册页中找到它。
It should give you something close to what you're looking for.
它应该给你一些接近你正在寻找的东西。