Saturday, May 4, 2024
30
rated 0 times [  30] [ 0]  / answers: 1 / hits: 16965  / 2 Years ago, wed, january 26, 2022, 8:47:01

Sometime I need to run an application from terminal for debugging. If I am sure the bug will occur short after launching the application, I can run this application from the Terminal.



However, bugs occur unexpectedly, and then only I need to monitor the buggy application from the Terminal (to see its output).



Can I then pick up an application from terminal, which was not launched using Terminal? If so how?


More From » command-line

 Answers
7

Each process in linux has a special directory /proc/{pid}/fd/. 0 is stdin, 1 is stdout and 2 is stderr. So, assuming you are only interested in diagnostic output you can determine the process pid, and then in the terminal do:



to see stdout:



cat /proc/{pid of process}/fd/1


to see stderr:



cat /proc/{pid of process}/fd/2

[#43656] Thursday, January 27, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
brasiplacar

Total Points: 314
Total Questions: 124
Total Answers: 97

Location: Dominican Republic
Member since Wed, Mar 17, 2021
3 Years ago
brasiplacar questions
Sat, Sep 4, 21, 13:11, 3 Years ago
Tue, Jan 10, 23, 06:22, 1 Year ago
Wed, Oct 13, 21, 15:19, 3 Years ago
Wed, May 4, 22, 00:06, 2 Years ago
Thu, Jan 5, 23, 15:40, 1 Year ago
;