Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When I start a graphical application from a terminal running bash, that application is somehow connected to that bash session. For example, when the applications dumps some text it will appear in the bash session it is started from. Also, some applications will get closed when i close the terminal using the close button, but not when i close the terminal by exiting the bash session using the exit command or CTRL+D.

How is a graphical application started from a bash session connected to that bash session?

bonus question: How can I inspect this connection? probably also manipulate?

share|improve this question

2 Answers 2

up vote 8 down vote accepted

The application is connected in two ways: to bash, and to the terminal.

The connection to the terminal is that the standard streams (stdin, stdout and stderr) of the application are connected to the terminal. Typical GUI applications don't use stdin or stdout, but they might emit error messages to stderr.

The connection to the shell is that if you started the application with foo &, it remains known to the shell as a job, as explained in Difference between nohup, disown and &. When you close the terminal, the shell receives a SIGHUP, which it propagates to its jobs. When you type exit in the shell, it disowns the jobs beforehand (this is configurable to some extent).

You can sever the shell connection with the disown built-in. You can't sever the terminal connection, at least not without underhand methods (using a debugger) that could crash the program.

share|improve this answer
    
s/severe/sever/g –  Dennis Williamson Nov 11 '10 at 22:45

Your shell starts these programs as child processes. If you run pstree you can see these relations. I don't know if/how you can manipulate it.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.