Running a pseudoterminal inside a pseudoterminal
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I'm trying to understand how the programs like screen
and script
control I/O.
My knowledge of terminal, tty etc. comes from reading the 'tty demystified' article, and all the SE answers I could find. So from what I understand, roughly the interactions between components work as follows:
Console(Keyboard+Screen) ---- xterm(pty master) ----- tty line discipline ---- bash/other programs(pty slave)
where the line discipline is in the kernel, and xterm and bash run in the userspace.
- Is this correct?
Now, when we consider programs like screen
, script
, they are userspace programs that run in a terminal(the existing xterm), yet are able to control I/O to/from other programs. The article mentions that this is becuase they run another pseudoterminal inside xterm(the existing pseudoterminal).
Does that mean that they open up a new
pty
master - slave pair, control the master end of this new pair, and all the processes launched from them run on the newpty
slave? For example each time I start a new 'screen', and run thetty
command, it shows me a diffrent/dev/pts/x
. Doesscript
also run in a similar way?Finally can somebody point me to any article/book where I can get a little more detail on this stuff(Haven't been able to find anything)?
I'd also like to reference this answer, though it is very brief.
terminal tty pty
add a comment |Â
up vote
2
down vote
favorite
I'm trying to understand how the programs like screen
and script
control I/O.
My knowledge of terminal, tty etc. comes from reading the 'tty demystified' article, and all the SE answers I could find. So from what I understand, roughly the interactions between components work as follows:
Console(Keyboard+Screen) ---- xterm(pty master) ----- tty line discipline ---- bash/other programs(pty slave)
where the line discipline is in the kernel, and xterm and bash run in the userspace.
- Is this correct?
Now, when we consider programs like screen
, script
, they are userspace programs that run in a terminal(the existing xterm), yet are able to control I/O to/from other programs. The article mentions that this is becuase they run another pseudoterminal inside xterm(the existing pseudoterminal).
Does that mean that they open up a new
pty
master - slave pair, control the master end of this new pair, and all the processes launched from them run on the newpty
slave? For example each time I start a new 'screen', and run thetty
command, it shows me a diffrent/dev/pts/x
. Doesscript
also run in a similar way?Finally can somebody point me to any article/book where I can get a little more detail on this stuff(Haven't been able to find anything)?
I'd also like to reference this answer, though it is very brief.
terminal tty pty
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I'm trying to understand how the programs like screen
and script
control I/O.
My knowledge of terminal, tty etc. comes from reading the 'tty demystified' article, and all the SE answers I could find. So from what I understand, roughly the interactions between components work as follows:
Console(Keyboard+Screen) ---- xterm(pty master) ----- tty line discipline ---- bash/other programs(pty slave)
where the line discipline is in the kernel, and xterm and bash run in the userspace.
- Is this correct?
Now, when we consider programs like screen
, script
, they are userspace programs that run in a terminal(the existing xterm), yet are able to control I/O to/from other programs. The article mentions that this is becuase they run another pseudoterminal inside xterm(the existing pseudoterminal).
Does that mean that they open up a new
pty
master - slave pair, control the master end of this new pair, and all the processes launched from them run on the newpty
slave? For example each time I start a new 'screen', and run thetty
command, it shows me a diffrent/dev/pts/x
. Doesscript
also run in a similar way?Finally can somebody point me to any article/book where I can get a little more detail on this stuff(Haven't been able to find anything)?
I'd also like to reference this answer, though it is very brief.
terminal tty pty
I'm trying to understand how the programs like screen
and script
control I/O.
My knowledge of terminal, tty etc. comes from reading the 'tty demystified' article, and all the SE answers I could find. So from what I understand, roughly the interactions between components work as follows:
Console(Keyboard+Screen) ---- xterm(pty master) ----- tty line discipline ---- bash/other programs(pty slave)
where the line discipline is in the kernel, and xterm and bash run in the userspace.
- Is this correct?
Now, when we consider programs like screen
, script
, they are userspace programs that run in a terminal(the existing xterm), yet are able to control I/O to/from other programs. The article mentions that this is becuase they run another pseudoterminal inside xterm(the existing pseudoterminal).
Does that mean that they open up a new
pty
master - slave pair, control the master end of this new pair, and all the processes launched from them run on the newpty
slave? For example each time I start a new 'screen', and run thetty
command, it shows me a diffrent/dev/pts/x
. Doesscript
also run in a similar way?Finally can somebody point me to any article/book where I can get a little more detail on this stuff(Haven't been able to find anything)?
I'd also like to reference this answer, though it is very brief.
terminal tty pty
edited Jan 3 at 16:24
asked Jan 3 at 16:14
forumulator
1285
1285
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
â Yes, xterm and bash run in userspace. As do screen and script.
â¡ Yep, that's correct. Screen basically is a terminal emulator, just like XTerm. Except of course XTerm outputs commands to the X11 server to display the terminal, whereas screen outputs control sequences & text to a another terminal (which can be a terminal emulator or an actual terminal).
⢠The best detail on how those programs work is probably the source code. Questions about them are welcome here, of course, or code questions are welcome on Stack Overflow.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
â Yes, xterm and bash run in userspace. As do screen and script.
â¡ Yep, that's correct. Screen basically is a terminal emulator, just like XTerm. Except of course XTerm outputs commands to the X11 server to display the terminal, whereas screen outputs control sequences & text to a another terminal (which can be a terminal emulator or an actual terminal).
⢠The best detail on how those programs work is probably the source code. Questions about them are welcome here, of course, or code questions are welcome on Stack Overflow.
add a comment |Â
up vote
2
down vote
accepted
â Yes, xterm and bash run in userspace. As do screen and script.
â¡ Yep, that's correct. Screen basically is a terminal emulator, just like XTerm. Except of course XTerm outputs commands to the X11 server to display the terminal, whereas screen outputs control sequences & text to a another terminal (which can be a terminal emulator or an actual terminal).
⢠The best detail on how those programs work is probably the source code. Questions about them are welcome here, of course, or code questions are welcome on Stack Overflow.
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
â Yes, xterm and bash run in userspace. As do screen and script.
â¡ Yep, that's correct. Screen basically is a terminal emulator, just like XTerm. Except of course XTerm outputs commands to the X11 server to display the terminal, whereas screen outputs control sequences & text to a another terminal (which can be a terminal emulator or an actual terminal).
⢠The best detail on how those programs work is probably the source code. Questions about them are welcome here, of course, or code questions are welcome on Stack Overflow.
â Yes, xterm and bash run in userspace. As do screen and script.
â¡ Yep, that's correct. Screen basically is a terminal emulator, just like XTerm. Except of course XTerm outputs commands to the X11 server to display the terminal, whereas screen outputs control sequences & text to a another terminal (which can be a terminal emulator or an actual terminal).
⢠The best detail on how those programs work is probably the source code. Questions about them are welcome here, of course, or code questions are welcome on Stack Overflow.
answered Jan 3 at 16:25
derobert
68.7k8148203
68.7k8148203
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f414579%2frunning-a-pseudoterminal-inside-a-pseudoterminal%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password