I have two Linux processes communicating via a nameless pipe. How can monitor the traffic in the pipe? How can I inject data into the pipe? I have root access and know the pipe inode.
A nameless pipe is by nature private to the applications that have the file descriptor. There's no principled way to observe or modify the traffic on the pipe. I don't think there's a way to look at the pipe directly on Linux, either.
There is an unprincipled way of more or less doing what you're after, though: through the ptrace system call. You wouldn't be tacking onto the pipe per se, but onto one of the processes. For observation, use strace, e.g.
(If you don't understand the last paragraph, I'm sorry, but it does require a certain level of technicity. I don't think there is an easier way.)
Some tools useful for monitoring a pipe :
For an already-running program where one doesn't control the piping, see the gdb method:
Or one can use strace :
shows only descriptor 1 calls. "2>&1" is to redirect stderr to stdout, as strace writes to stderr by default.