Concept of controlling terminal in Unix

Can some one please explain in an easy to understand way the concept of controlling terminal in unix and unix like systems ? Is it related to a session ? If yes, then how ?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

There is a process group leader – sort of like the head process – that owns the terminal, /dev/tty. A process group can be one or many processes.

The stty command changes and displays terminal settings. If you are actually going to use UNIX seriously consider finding a copy of Stevens ‘Advanced Programming in the UNIX Environment’.
Terminals have a lot of heavy baggage from the 1970’s. You will spot that right away. Most of those odd settings can be ignored except for special things like UNIX system consoles.

Method 2

A terminal is a file in the file-system through which (usually) a user interacts with a non-GUI program.
When you run a program from a remote or local shell, it is associated to your terminal, and unless you or it redirect it’s input or output, it is read and written from/to that terminal.

When a terminal is closed, programs running in it are signaled so they can exit or detach themselves.

Regarding it’s connection to “session”: if you are referring to a GUI session, then it has no direct relation to it, apart from the fact that some UNIX and UNIX like systems run the GUI under it’s own terminal.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x