Attach to a processes output for viewing

前端 未结 7 847
北荒
北荒 2020-12-12 08:26

How would I \'attach\' a console/terminal-view to an applications output so I can see what it may be saying?

How would I detach from an applications output without k

相关标签:
7条回答
  • 2020-12-12 09:25

    I think I have a simpler solution here. Just look for a directory whose name corresponds to the PID you are looking for, under the pseudo-filesystem accessible under the /proc path. So if you have a program running, whose ID is 1199, cd into it:

    $ cd /proc/1199
    

    Then look for the fd directory underneath

    $ cd fd
    

    This fd directory hold the file-descriptors objects that your program is using (0: stdin, 1: stdout, 2: stderr) and just tail -f the one you need - in this case, stdout):

    $ tail -f 1
    
    0 讨论(0)
提交回复
热议问题