How to have a terminal mirrored onto a second screen in a two-monitor setup?
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
25
down vote
favorite
I teach using a two-monitor setup, so what I see in my desktop is different from what my audience can see. This works fine for presentations: while the students see the slides, I can see my notes.
But I want to use a terminal to run a shell. However, the terminal has to be on my desktop OR on the external screen.
Is there a way to show the terminal contents in both screens simultaneously? I don't want to mirror the screens, but stick to the two-monitor mode.
Any hints?
I'm using Ubuntu with Gnome.
command-line multiple-monitors display
add a comment |Â
up vote
25
down vote
favorite
I teach using a two-monitor setup, so what I see in my desktop is different from what my audience can see. This works fine for presentations: while the students see the slides, I can see my notes.
But I want to use a terminal to run a shell. However, the terminal has to be on my desktop OR on the external screen.
Is there a way to show the terminal contents in both screens simultaneously? I don't want to mirror the screens, but stick to the two-monitor mode.
Any hints?
I'm using Ubuntu with Gnome.
command-line multiple-monitors display
Well, you can mirror your desktop and show the terminal emulator, that's one way, if you just want to show terminal in any way so long as it works. Are you talking about TTY specifically ? Then the two already existing answers for screen and tmux can work. Really depends on your needs
â Sergiy Kolodyazhnyy
Apr 24 at 18:18
Not a duplicate, because this question is specifically about terminals which means there are other options (eg screen, tmux) available, but this question is very closely related and the answer there should work for this problem too.
â psmears
Apr 25 at 13:27
@Sergiy Kolodyazhnyy: I don't want to mirror the desktop because it messes up with the presentation. When I switch back to separate screens, the slides don't fit the screen anymore; sometimes the slides go to my desktop. tmux is working fine for me.
â Jander
Apr 25 at 16:44
add a comment |Â
up vote
25
down vote
favorite
up vote
25
down vote
favorite
I teach using a two-monitor setup, so what I see in my desktop is different from what my audience can see. This works fine for presentations: while the students see the slides, I can see my notes.
But I want to use a terminal to run a shell. However, the terminal has to be on my desktop OR on the external screen.
Is there a way to show the terminal contents in both screens simultaneously? I don't want to mirror the screens, but stick to the two-monitor mode.
Any hints?
I'm using Ubuntu with Gnome.
command-line multiple-monitors display
I teach using a two-monitor setup, so what I see in my desktop is different from what my audience can see. This works fine for presentations: while the students see the slides, I can see my notes.
But I want to use a terminal to run a shell. However, the terminal has to be on my desktop OR on the external screen.
Is there a way to show the terminal contents in both screens simultaneously? I don't want to mirror the screens, but stick to the two-monitor mode.
Any hints?
I'm using Ubuntu with Gnome.
command-line multiple-monitors display
asked Apr 24 at 16:56
Jander
12815
12815
Well, you can mirror your desktop and show the terminal emulator, that's one way, if you just want to show terminal in any way so long as it works. Are you talking about TTY specifically ? Then the two already existing answers for screen and tmux can work. Really depends on your needs
â Sergiy Kolodyazhnyy
Apr 24 at 18:18
Not a duplicate, because this question is specifically about terminals which means there are other options (eg screen, tmux) available, but this question is very closely related and the answer there should work for this problem too.
â psmears
Apr 25 at 13:27
@Sergiy Kolodyazhnyy: I don't want to mirror the desktop because it messes up with the presentation. When I switch back to separate screens, the slides don't fit the screen anymore; sometimes the slides go to my desktop. tmux is working fine for me.
â Jander
Apr 25 at 16:44
add a comment |Â
Well, you can mirror your desktop and show the terminal emulator, that's one way, if you just want to show terminal in any way so long as it works. Are you talking about TTY specifically ? Then the two already existing answers for screen and tmux can work. Really depends on your needs
â Sergiy Kolodyazhnyy
Apr 24 at 18:18
Not a duplicate, because this question is specifically about terminals which means there are other options (eg screen, tmux) available, but this question is very closely related and the answer there should work for this problem too.
â psmears
Apr 25 at 13:27
@Sergiy Kolodyazhnyy: I don't want to mirror the desktop because it messes up with the presentation. When I switch back to separate screens, the slides don't fit the screen anymore; sometimes the slides go to my desktop. tmux is working fine for me.
â Jander
Apr 25 at 16:44
Well, you can mirror your desktop and show the terminal emulator, that's one way, if you just want to show terminal in any way so long as it works. Are you talking about TTY specifically ? Then the two already existing answers for screen and tmux can work. Really depends on your needs
â Sergiy Kolodyazhnyy
Apr 24 at 18:18
Well, you can mirror your desktop and show the terminal emulator, that's one way, if you just want to show terminal in any way so long as it works. Are you talking about TTY specifically ? Then the two already existing answers for screen and tmux can work. Really depends on your needs
â Sergiy Kolodyazhnyy
Apr 24 at 18:18
Not a duplicate, because this question is specifically about terminals which means there are other options (eg screen, tmux) available, but this question is very closely related and the answer there should work for this problem too.
â psmears
Apr 25 at 13:27
Not a duplicate, because this question is specifically about terminals which means there are other options (eg screen, tmux) available, but this question is very closely related and the answer there should work for this problem too.
â psmears
Apr 25 at 13:27
@Sergiy Kolodyazhnyy: I don't want to mirror the desktop because it messes up with the presentation. When I switch back to separate screens, the slides don't fit the screen anymore; sometimes the slides go to my desktop. tmux is working fine for me.
â Jander
Apr 25 at 16:44
@Sergiy Kolodyazhnyy: I don't want to mirror the desktop because it messes up with the presentation. When I switch back to separate screens, the slides don't fit the screen anymore; sometimes the slides go to my desktop. tmux is working fine for me.
â Jander
Apr 25 at 16:44
add a comment |Â
4 Answers
4
active
oldest
votes
up vote
16
down vote
accepted
The Portable Solution
Use script
! For example:
Personal terminal:
> script -f /tmp/lecture1.scrpt #use -F instead on MacOS
> ... #start doing things here!
Presentation terminal:
> #after this, terminal will continuously print whatever's written to personal terminal
> tail -F /tmp/lecture1.scrpt
How It Works
The script
command copies everything written to the terminal screen (including what you type!) into a file it takes as a parameter. Ordinarily everything gets written to the file after you end the script (by typing exit
). However, the -f
option causes script
to flush its buffer after every write (on MacOS, this will be -F
or -t 0
). Then, in the presentation terminal, you can use tail -F
to see the contents continuously as they're written.
Things to Note
Since one terminal is writing to a file and the other is reading, this can be done between different users! This means you can have someone ssh in with very few permissions and as long as you place the script file in a location they can read, you'll still be able to present to them. (ie: if you have a server your students have access to, you could create a .scrpt file that'd be only readable for them so they could follow along on their own screens)
Given the nature of this method, one terminal is driving and the other is only watching.
This method also has the added bonus of making it easy for you to stop mirroring, do some secret work and begin mirorring again all without leaving your personal terminal. This can be done with the following:
Personal terminal:
> exit #end script session; stop writing to /tmp/lecture1.scrpt
> ... #do secret things not safe for student eyes!
> script -f -a /tmp/lecture1.scrpt #begin writing again with -a to append
More Fun With script
!
The purpose of script
is to record your terminal session so it can be played back later (we just happen to be the special case of playing back as it's recording). To help with this, script
has the -t
option to record timing along with what's written to the screen. To use it, start your script session with:
> script -f -t 2>/tmp/lecture1.timing /tmp/lecture1.scrpt
And play it back (with timing!) with:
> scriptreplay -t /tmp/lecture1.timing -s /tmp/lecture1.scrpt
Have a student that emailed you saying he'd be sick and can't make lecture? Or just want to give your students more lecture material? If you record your voice during the lecture (and start script at about the same time as the recording), then your students could play back your terminal session with your voice and get the full lecture experience!
Have a student who likes to play all of his videos at 2x speed? scriptreplay
takes a "divisor" that it multiplies the play speed by! Just pass -d 2
to play at 2x speed (note this is a double value, so you could even do -d .5
for half speed!).
Wow, interesting! The astonishing thing is that this seems to handle up-history browsing, deletions, colours... flawlessly. Wouldn't have thought this was possible withtail
. (I thinktmux
is still better in practice, because it also has no problem with e.g. an editor session.)
â leftaroundabout
Apr 26 at 8:48
Really interesting approach! It can handle window size changes, whiletmux
andscreen
cannot, as far as I can tell.
â Jander
Apr 26 at 14:34
@leftaroundabout the magic here is actually just how littletail
is really doing. If you look at a script file with something likevim
orless
you'll see it adding ugly escapes since it's trying to control your screen scrolling and character placement.
â scohe001
Apr 26 at 15:56
@leftaroundabout by "editor session" do you mean something likevim
? As far as I can tell, this seems to work fine (as long as the presentation terminal is bigger than the personal terminal)
â scohe001
Apr 26 at 15:57
add a comment |Â
up vote
36
down vote
One elegant way is to use tmux
for this task: sudo apt install tmux
. Here is an example:
Create a session called
my_session
(remove-d
to attach during the creation):tmux new-session -d -s my_session
Open one or more new terminal windows and attach to the same session:
tmux attach -t my_session
To detach from a session type:
tmux detach
Or press Ctrl+b, then release Ctrl and press d.
To send a command to the session without attaching to it:
tmux send-keys -t my_session "echo Hello World!" ENTER Enter
Note the
exit
command, executed from inside, will close the session.
1
Works perfectly! Thanks.
â Jander
Apr 25 at 16:40
add a comment |Â
up vote
29
down vote
Can't think of any way to directly achieve what you want - perhaps others can. But I can think of a workaround.
Install screen
with sudo apt install screen
. Start two terminals. In the first one, type screen
and press enter at the nag screen you get. In the second one, type screen -x
.
They will effectively show the same content. It's not the same terminal window, but it will be the same content.
Screen can do more tricks as well, such as multiple windows that you can switch between. This is a quick tutorial of the features available.
Works perfectly, as well as tmux. Thanks.
â Jander
Apr 25 at 16:46
Sorry I can't choose two answers as the correct one...
â Jander
Apr 25 at 16:48
1
That's perfectly fine:) I've upvoted the other answer myself :)
â vidarlo
Apr 25 at 16:49
add a comment |Â
up vote
4
down vote
besides pa4080's answer above to use tmux, I'd like to suggest an extended version:
Give tmate a try. Its available as Ubuntu package as well. While it can be used as tmux replacement, it could do more: I can replicate your terminal session using a tmate public server accessible via ssh or http (read-only or full share). So your students could use either your beamer projection or have a read only view of your terminal session directly in their browser on their personal computer / tablet etc.
tmate
looks interesting. Here is a simple demo: youtube.com/watch?v=is_VpIx3Z4M
â pa4080
Apr 26 at 16:14
add a comment |Â
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
16
down vote
accepted
The Portable Solution
Use script
! For example:
Personal terminal:
> script -f /tmp/lecture1.scrpt #use -F instead on MacOS
> ... #start doing things here!
Presentation terminal:
> #after this, terminal will continuously print whatever's written to personal terminal
> tail -F /tmp/lecture1.scrpt
How It Works
The script
command copies everything written to the terminal screen (including what you type!) into a file it takes as a parameter. Ordinarily everything gets written to the file after you end the script (by typing exit
). However, the -f
option causes script
to flush its buffer after every write (on MacOS, this will be -F
or -t 0
). Then, in the presentation terminal, you can use tail -F
to see the contents continuously as they're written.
Things to Note
Since one terminal is writing to a file and the other is reading, this can be done between different users! This means you can have someone ssh in with very few permissions and as long as you place the script file in a location they can read, you'll still be able to present to them. (ie: if you have a server your students have access to, you could create a .scrpt file that'd be only readable for them so they could follow along on their own screens)
Given the nature of this method, one terminal is driving and the other is only watching.
This method also has the added bonus of making it easy for you to stop mirroring, do some secret work and begin mirorring again all without leaving your personal terminal. This can be done with the following:
Personal terminal:
> exit #end script session; stop writing to /tmp/lecture1.scrpt
> ... #do secret things not safe for student eyes!
> script -f -a /tmp/lecture1.scrpt #begin writing again with -a to append
More Fun With script
!
The purpose of script
is to record your terminal session so it can be played back later (we just happen to be the special case of playing back as it's recording). To help with this, script
has the -t
option to record timing along with what's written to the screen. To use it, start your script session with:
> script -f -t 2>/tmp/lecture1.timing /tmp/lecture1.scrpt
And play it back (with timing!) with:
> scriptreplay -t /tmp/lecture1.timing -s /tmp/lecture1.scrpt
Have a student that emailed you saying he'd be sick and can't make lecture? Or just want to give your students more lecture material? If you record your voice during the lecture (and start script at about the same time as the recording), then your students could play back your terminal session with your voice and get the full lecture experience!
Have a student who likes to play all of his videos at 2x speed? scriptreplay
takes a "divisor" that it multiplies the play speed by! Just pass -d 2
to play at 2x speed (note this is a double value, so you could even do -d .5
for half speed!).
Wow, interesting! The astonishing thing is that this seems to handle up-history browsing, deletions, colours... flawlessly. Wouldn't have thought this was possible withtail
. (I thinktmux
is still better in practice, because it also has no problem with e.g. an editor session.)
â leftaroundabout
Apr 26 at 8:48
Really interesting approach! It can handle window size changes, whiletmux
andscreen
cannot, as far as I can tell.
â Jander
Apr 26 at 14:34
@leftaroundabout the magic here is actually just how littletail
is really doing. If you look at a script file with something likevim
orless
you'll see it adding ugly escapes since it's trying to control your screen scrolling and character placement.
â scohe001
Apr 26 at 15:56
@leftaroundabout by "editor session" do you mean something likevim
? As far as I can tell, this seems to work fine (as long as the presentation terminal is bigger than the personal terminal)
â scohe001
Apr 26 at 15:57
add a comment |Â
up vote
16
down vote
accepted
The Portable Solution
Use script
! For example:
Personal terminal:
> script -f /tmp/lecture1.scrpt #use -F instead on MacOS
> ... #start doing things here!
Presentation terminal:
> #after this, terminal will continuously print whatever's written to personal terminal
> tail -F /tmp/lecture1.scrpt
How It Works
The script
command copies everything written to the terminal screen (including what you type!) into a file it takes as a parameter. Ordinarily everything gets written to the file after you end the script (by typing exit
). However, the -f
option causes script
to flush its buffer after every write (on MacOS, this will be -F
or -t 0
). Then, in the presentation terminal, you can use tail -F
to see the contents continuously as they're written.
Things to Note
Since one terminal is writing to a file and the other is reading, this can be done between different users! This means you can have someone ssh in with very few permissions and as long as you place the script file in a location they can read, you'll still be able to present to them. (ie: if you have a server your students have access to, you could create a .scrpt file that'd be only readable for them so they could follow along on their own screens)
Given the nature of this method, one terminal is driving and the other is only watching.
This method also has the added bonus of making it easy for you to stop mirroring, do some secret work and begin mirorring again all without leaving your personal terminal. This can be done with the following:
Personal terminal:
> exit #end script session; stop writing to /tmp/lecture1.scrpt
> ... #do secret things not safe for student eyes!
> script -f -a /tmp/lecture1.scrpt #begin writing again with -a to append
More Fun With script
!
The purpose of script
is to record your terminal session so it can be played back later (we just happen to be the special case of playing back as it's recording). To help with this, script
has the -t
option to record timing along with what's written to the screen. To use it, start your script session with:
> script -f -t 2>/tmp/lecture1.timing /tmp/lecture1.scrpt
And play it back (with timing!) with:
> scriptreplay -t /tmp/lecture1.timing -s /tmp/lecture1.scrpt
Have a student that emailed you saying he'd be sick and can't make lecture? Or just want to give your students more lecture material? If you record your voice during the lecture (and start script at about the same time as the recording), then your students could play back your terminal session with your voice and get the full lecture experience!
Have a student who likes to play all of his videos at 2x speed? scriptreplay
takes a "divisor" that it multiplies the play speed by! Just pass -d 2
to play at 2x speed (note this is a double value, so you could even do -d .5
for half speed!).
Wow, interesting! The astonishing thing is that this seems to handle up-history browsing, deletions, colours... flawlessly. Wouldn't have thought this was possible withtail
. (I thinktmux
is still better in practice, because it also has no problem with e.g. an editor session.)
â leftaroundabout
Apr 26 at 8:48
Really interesting approach! It can handle window size changes, whiletmux
andscreen
cannot, as far as I can tell.
â Jander
Apr 26 at 14:34
@leftaroundabout the magic here is actually just how littletail
is really doing. If you look at a script file with something likevim
orless
you'll see it adding ugly escapes since it's trying to control your screen scrolling and character placement.
â scohe001
Apr 26 at 15:56
@leftaroundabout by "editor session" do you mean something likevim
? As far as I can tell, this seems to work fine (as long as the presentation terminal is bigger than the personal terminal)
â scohe001
Apr 26 at 15:57
add a comment |Â
up vote
16
down vote
accepted
up vote
16
down vote
accepted
The Portable Solution
Use script
! For example:
Personal terminal:
> script -f /tmp/lecture1.scrpt #use -F instead on MacOS
> ... #start doing things here!
Presentation terminal:
> #after this, terminal will continuously print whatever's written to personal terminal
> tail -F /tmp/lecture1.scrpt
How It Works
The script
command copies everything written to the terminal screen (including what you type!) into a file it takes as a parameter. Ordinarily everything gets written to the file after you end the script (by typing exit
). However, the -f
option causes script
to flush its buffer after every write (on MacOS, this will be -F
or -t 0
). Then, in the presentation terminal, you can use tail -F
to see the contents continuously as they're written.
Things to Note
Since one terminal is writing to a file and the other is reading, this can be done between different users! This means you can have someone ssh in with very few permissions and as long as you place the script file in a location they can read, you'll still be able to present to them. (ie: if you have a server your students have access to, you could create a .scrpt file that'd be only readable for them so they could follow along on their own screens)
Given the nature of this method, one terminal is driving and the other is only watching.
This method also has the added bonus of making it easy for you to stop mirroring, do some secret work and begin mirorring again all without leaving your personal terminal. This can be done with the following:
Personal terminal:
> exit #end script session; stop writing to /tmp/lecture1.scrpt
> ... #do secret things not safe for student eyes!
> script -f -a /tmp/lecture1.scrpt #begin writing again with -a to append
More Fun With script
!
The purpose of script
is to record your terminal session so it can be played back later (we just happen to be the special case of playing back as it's recording). To help with this, script
has the -t
option to record timing along with what's written to the screen. To use it, start your script session with:
> script -f -t 2>/tmp/lecture1.timing /tmp/lecture1.scrpt
And play it back (with timing!) with:
> scriptreplay -t /tmp/lecture1.timing -s /tmp/lecture1.scrpt
Have a student that emailed you saying he'd be sick and can't make lecture? Or just want to give your students more lecture material? If you record your voice during the lecture (and start script at about the same time as the recording), then your students could play back your terminal session with your voice and get the full lecture experience!
Have a student who likes to play all of his videos at 2x speed? scriptreplay
takes a "divisor" that it multiplies the play speed by! Just pass -d 2
to play at 2x speed (note this is a double value, so you could even do -d .5
for half speed!).
The Portable Solution
Use script
! For example:
Personal terminal:
> script -f /tmp/lecture1.scrpt #use -F instead on MacOS
> ... #start doing things here!
Presentation terminal:
> #after this, terminal will continuously print whatever's written to personal terminal
> tail -F /tmp/lecture1.scrpt
How It Works
The script
command copies everything written to the terminal screen (including what you type!) into a file it takes as a parameter. Ordinarily everything gets written to the file after you end the script (by typing exit
). However, the -f
option causes script
to flush its buffer after every write (on MacOS, this will be -F
or -t 0
). Then, in the presentation terminal, you can use tail -F
to see the contents continuously as they're written.
Things to Note
Since one terminal is writing to a file and the other is reading, this can be done between different users! This means you can have someone ssh in with very few permissions and as long as you place the script file in a location they can read, you'll still be able to present to them. (ie: if you have a server your students have access to, you could create a .scrpt file that'd be only readable for them so they could follow along on their own screens)
Given the nature of this method, one terminal is driving and the other is only watching.
This method also has the added bonus of making it easy for you to stop mirroring, do some secret work and begin mirorring again all without leaving your personal terminal. This can be done with the following:
Personal terminal:
> exit #end script session; stop writing to /tmp/lecture1.scrpt
> ... #do secret things not safe for student eyes!
> script -f -a /tmp/lecture1.scrpt #begin writing again with -a to append
More Fun With script
!
The purpose of script
is to record your terminal session so it can be played back later (we just happen to be the special case of playing back as it's recording). To help with this, script
has the -t
option to record timing along with what's written to the screen. To use it, start your script session with:
> script -f -t 2>/tmp/lecture1.timing /tmp/lecture1.scrpt
And play it back (with timing!) with:
> scriptreplay -t /tmp/lecture1.timing -s /tmp/lecture1.scrpt
Have a student that emailed you saying he'd be sick and can't make lecture? Or just want to give your students more lecture material? If you record your voice during the lecture (and start script at about the same time as the recording), then your students could play back your terminal session with your voice and get the full lecture experience!
Have a student who likes to play all of his videos at 2x speed? scriptreplay
takes a "divisor" that it multiplies the play speed by! Just pass -d 2
to play at 2x speed (note this is a double value, so you could even do -d .5
for half speed!).
edited Apr 26 at 23:19
answered Apr 25 at 18:56
scohe001
28517
28517
Wow, interesting! The astonishing thing is that this seems to handle up-history browsing, deletions, colours... flawlessly. Wouldn't have thought this was possible withtail
. (I thinktmux
is still better in practice, because it also has no problem with e.g. an editor session.)
â leftaroundabout
Apr 26 at 8:48
Really interesting approach! It can handle window size changes, whiletmux
andscreen
cannot, as far as I can tell.
â Jander
Apr 26 at 14:34
@leftaroundabout the magic here is actually just how littletail
is really doing. If you look at a script file with something likevim
orless
you'll see it adding ugly escapes since it's trying to control your screen scrolling and character placement.
â scohe001
Apr 26 at 15:56
@leftaroundabout by "editor session" do you mean something likevim
? As far as I can tell, this seems to work fine (as long as the presentation terminal is bigger than the personal terminal)
â scohe001
Apr 26 at 15:57
add a comment |Â
Wow, interesting! The astonishing thing is that this seems to handle up-history browsing, deletions, colours... flawlessly. Wouldn't have thought this was possible withtail
. (I thinktmux
is still better in practice, because it also has no problem with e.g. an editor session.)
â leftaroundabout
Apr 26 at 8:48
Really interesting approach! It can handle window size changes, whiletmux
andscreen
cannot, as far as I can tell.
â Jander
Apr 26 at 14:34
@leftaroundabout the magic here is actually just how littletail
is really doing. If you look at a script file with something likevim
orless
you'll see it adding ugly escapes since it's trying to control your screen scrolling and character placement.
â scohe001
Apr 26 at 15:56
@leftaroundabout by "editor session" do you mean something likevim
? As far as I can tell, this seems to work fine (as long as the presentation terminal is bigger than the personal terminal)
â scohe001
Apr 26 at 15:57
Wow, interesting! The astonishing thing is that this seems to handle up-history browsing, deletions, colours... flawlessly. Wouldn't have thought this was possible with
tail
. (I think tmux
is still better in practice, because it also has no problem with e.g. an editor session.)â leftaroundabout
Apr 26 at 8:48
Wow, interesting! The astonishing thing is that this seems to handle up-history browsing, deletions, colours... flawlessly. Wouldn't have thought this was possible with
tail
. (I think tmux
is still better in practice, because it also has no problem with e.g. an editor session.)â leftaroundabout
Apr 26 at 8:48
Really interesting approach! It can handle window size changes, while
tmux
and screen
cannot, as far as I can tell.â Jander
Apr 26 at 14:34
Really interesting approach! It can handle window size changes, while
tmux
and screen
cannot, as far as I can tell.â Jander
Apr 26 at 14:34
@leftaroundabout the magic here is actually just how little
tail
is really doing. If you look at a script file with something like vim
or less
you'll see it adding ugly escapes since it's trying to control your screen scrolling and character placement.â scohe001
Apr 26 at 15:56
@leftaroundabout the magic here is actually just how little
tail
is really doing. If you look at a script file with something like vim
or less
you'll see it adding ugly escapes since it's trying to control your screen scrolling and character placement.â scohe001
Apr 26 at 15:56
@leftaroundabout by "editor session" do you mean something like
vim
? As far as I can tell, this seems to work fine (as long as the presentation terminal is bigger than the personal terminal)â scohe001
Apr 26 at 15:57
@leftaroundabout by "editor session" do you mean something like
vim
? As far as I can tell, this seems to work fine (as long as the presentation terminal is bigger than the personal terminal)â scohe001
Apr 26 at 15:57
add a comment |Â
up vote
36
down vote
One elegant way is to use tmux
for this task: sudo apt install tmux
. Here is an example:
Create a session called
my_session
(remove-d
to attach during the creation):tmux new-session -d -s my_session
Open one or more new terminal windows and attach to the same session:
tmux attach -t my_session
To detach from a session type:
tmux detach
Or press Ctrl+b, then release Ctrl and press d.
To send a command to the session without attaching to it:
tmux send-keys -t my_session "echo Hello World!" ENTER Enter
Note the
exit
command, executed from inside, will close the session.
1
Works perfectly! Thanks.
â Jander
Apr 25 at 16:40
add a comment |Â
up vote
36
down vote
One elegant way is to use tmux
for this task: sudo apt install tmux
. Here is an example:
Create a session called
my_session
(remove-d
to attach during the creation):tmux new-session -d -s my_session
Open one or more new terminal windows and attach to the same session:
tmux attach -t my_session
To detach from a session type:
tmux detach
Or press Ctrl+b, then release Ctrl and press d.
To send a command to the session without attaching to it:
tmux send-keys -t my_session "echo Hello World!" ENTER Enter
Note the
exit
command, executed from inside, will close the session.
1
Works perfectly! Thanks.
â Jander
Apr 25 at 16:40
add a comment |Â
up vote
36
down vote
up vote
36
down vote
One elegant way is to use tmux
for this task: sudo apt install tmux
. Here is an example:
Create a session called
my_session
(remove-d
to attach during the creation):tmux new-session -d -s my_session
Open one or more new terminal windows and attach to the same session:
tmux attach -t my_session
To detach from a session type:
tmux detach
Or press Ctrl+b, then release Ctrl and press d.
To send a command to the session without attaching to it:
tmux send-keys -t my_session "echo Hello World!" ENTER Enter
Note the
exit
command, executed from inside, will close the session.
One elegant way is to use tmux
for this task: sudo apt install tmux
. Here is an example:
Create a session called
my_session
(remove-d
to attach during the creation):tmux new-session -d -s my_session
Open one or more new terminal windows and attach to the same session:
tmux attach -t my_session
To detach from a session type:
tmux detach
Or press Ctrl+b, then release Ctrl and press d.
To send a command to the session without attaching to it:
tmux send-keys -t my_session "echo Hello World!" ENTER Enter
Note the
exit
command, executed from inside, will close the session.
edited Apr 25 at 8:05
answered Apr 24 at 17:20
![](https://i.stack.imgur.com/Lrlbx.jpg?s=32&g=1)
![](https://i.stack.imgur.com/Lrlbx.jpg?s=32&g=1)
pa4080
12k52255
12k52255
1
Works perfectly! Thanks.
â Jander
Apr 25 at 16:40
add a comment |Â
1
Works perfectly! Thanks.
â Jander
Apr 25 at 16:40
1
1
Works perfectly! Thanks.
â Jander
Apr 25 at 16:40
Works perfectly! Thanks.
â Jander
Apr 25 at 16:40
add a comment |Â
up vote
29
down vote
Can't think of any way to directly achieve what you want - perhaps others can. But I can think of a workaround.
Install screen
with sudo apt install screen
. Start two terminals. In the first one, type screen
and press enter at the nag screen you get. In the second one, type screen -x
.
They will effectively show the same content. It's not the same terminal window, but it will be the same content.
Screen can do more tricks as well, such as multiple windows that you can switch between. This is a quick tutorial of the features available.
Works perfectly, as well as tmux. Thanks.
â Jander
Apr 25 at 16:46
Sorry I can't choose two answers as the correct one...
â Jander
Apr 25 at 16:48
1
That's perfectly fine:) I've upvoted the other answer myself :)
â vidarlo
Apr 25 at 16:49
add a comment |Â
up vote
29
down vote
Can't think of any way to directly achieve what you want - perhaps others can. But I can think of a workaround.
Install screen
with sudo apt install screen
. Start two terminals. In the first one, type screen
and press enter at the nag screen you get. In the second one, type screen -x
.
They will effectively show the same content. It's not the same terminal window, but it will be the same content.
Screen can do more tricks as well, such as multiple windows that you can switch between. This is a quick tutorial of the features available.
Works perfectly, as well as tmux. Thanks.
â Jander
Apr 25 at 16:46
Sorry I can't choose two answers as the correct one...
â Jander
Apr 25 at 16:48
1
That's perfectly fine:) I've upvoted the other answer myself :)
â vidarlo
Apr 25 at 16:49
add a comment |Â
up vote
29
down vote
up vote
29
down vote
Can't think of any way to directly achieve what you want - perhaps others can. But I can think of a workaround.
Install screen
with sudo apt install screen
. Start two terminals. In the first one, type screen
and press enter at the nag screen you get. In the second one, type screen -x
.
They will effectively show the same content. It's not the same terminal window, but it will be the same content.
Screen can do more tricks as well, such as multiple windows that you can switch between. This is a quick tutorial of the features available.
Can't think of any way to directly achieve what you want - perhaps others can. But I can think of a workaround.
Install screen
with sudo apt install screen
. Start two terminals. In the first one, type screen
and press enter at the nag screen you get. In the second one, type screen -x
.
They will effectively show the same content. It's not the same terminal window, but it will be the same content.
Screen can do more tricks as well, such as multiple windows that you can switch between. This is a quick tutorial of the features available.
answered Apr 24 at 17:11
![](https://i.stack.imgur.com/AKwUL.png?s=32&g=1)
![](https://i.stack.imgur.com/AKwUL.png?s=32&g=1)
vidarlo
7,12342140
7,12342140
Works perfectly, as well as tmux. Thanks.
â Jander
Apr 25 at 16:46
Sorry I can't choose two answers as the correct one...
â Jander
Apr 25 at 16:48
1
That's perfectly fine:) I've upvoted the other answer myself :)
â vidarlo
Apr 25 at 16:49
add a comment |Â
Works perfectly, as well as tmux. Thanks.
â Jander
Apr 25 at 16:46
Sorry I can't choose two answers as the correct one...
â Jander
Apr 25 at 16:48
1
That's perfectly fine:) I've upvoted the other answer myself :)
â vidarlo
Apr 25 at 16:49
Works perfectly, as well as tmux. Thanks.
â Jander
Apr 25 at 16:46
Works perfectly, as well as tmux. Thanks.
â Jander
Apr 25 at 16:46
Sorry I can't choose two answers as the correct one...
â Jander
Apr 25 at 16:48
Sorry I can't choose two answers as the correct one...
â Jander
Apr 25 at 16:48
1
1
That's perfectly fine:) I've upvoted the other answer myself :)
â vidarlo
Apr 25 at 16:49
That's perfectly fine:) I've upvoted the other answer myself :)
â vidarlo
Apr 25 at 16:49
add a comment |Â
up vote
4
down vote
besides pa4080's answer above to use tmux, I'd like to suggest an extended version:
Give tmate a try. Its available as Ubuntu package as well. While it can be used as tmux replacement, it could do more: I can replicate your terminal session using a tmate public server accessible via ssh or http (read-only or full share). So your students could use either your beamer projection or have a read only view of your terminal session directly in their browser on their personal computer / tablet etc.
tmate
looks interesting. Here is a simple demo: youtube.com/watch?v=is_VpIx3Z4M
â pa4080
Apr 26 at 16:14
add a comment |Â
up vote
4
down vote
besides pa4080's answer above to use tmux, I'd like to suggest an extended version:
Give tmate a try. Its available as Ubuntu package as well. While it can be used as tmux replacement, it could do more: I can replicate your terminal session using a tmate public server accessible via ssh or http (read-only or full share). So your students could use either your beamer projection or have a read only view of your terminal session directly in their browser on their personal computer / tablet etc.
tmate
looks interesting. Here is a simple demo: youtube.com/watch?v=is_VpIx3Z4M
â pa4080
Apr 26 at 16:14
add a comment |Â
up vote
4
down vote
up vote
4
down vote
besides pa4080's answer above to use tmux, I'd like to suggest an extended version:
Give tmate a try. Its available as Ubuntu package as well. While it can be used as tmux replacement, it could do more: I can replicate your terminal session using a tmate public server accessible via ssh or http (read-only or full share). So your students could use either your beamer projection or have a read only view of your terminal session directly in their browser on their personal computer / tablet etc.
besides pa4080's answer above to use tmux, I'd like to suggest an extended version:
Give tmate a try. Its available as Ubuntu package as well. While it can be used as tmux replacement, it could do more: I can replicate your terminal session using a tmate public server accessible via ssh or http (read-only or full share). So your students could use either your beamer projection or have a read only view of your terminal session directly in their browser on their personal computer / tablet etc.
answered Apr 26 at 16:01
![](https://lh4.googleusercontent.com/-20qCa6beqwY/AAAAAAAAAAI/AAAAAAAAAiY/vq59vvgF0XE/photo.jpg?sz=32)
![](https://lh4.googleusercontent.com/-20qCa6beqwY/AAAAAAAAAAI/AAAAAAAAAiY/vq59vvgF0XE/photo.jpg?sz=32)
pdr
1434
1434
tmate
looks interesting. Here is a simple demo: youtube.com/watch?v=is_VpIx3Z4M
â pa4080
Apr 26 at 16:14
add a comment |Â
tmate
looks interesting. Here is a simple demo: youtube.com/watch?v=is_VpIx3Z4M
â pa4080
Apr 26 at 16:14
tmate
looks interesting. Here is a simple demo: youtube.com/watch?v=is_VpIx3Z4Mâ pa4080
Apr 26 at 16:14
tmate
looks interesting. Here is a simple demo: youtube.com/watch?v=is_VpIx3Z4Mâ pa4080
Apr 26 at 16:14
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
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%2faskubuntu.com%2fquestions%2f1027872%2fhow-to-have-a-terminal-mirrored-onto-a-second-screen-in-a-two-monitor-setup%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
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');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
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');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
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
Well, you can mirror your desktop and show the terminal emulator, that's one way, if you just want to show terminal in any way so long as it works. Are you talking about TTY specifically ? Then the two already existing answers for screen and tmux can work. Really depends on your needs
â Sergiy Kolodyazhnyy
Apr 24 at 18:18
Not a duplicate, because this question is specifically about terminals which means there are other options (eg screen, tmux) available, but this question is very closely related and the answer there should work for this problem too.
â psmears
Apr 25 at 13:27
@Sergiy Kolodyazhnyy: I don't want to mirror the desktop because it messes up with the presentation. When I switch back to separate screens, the slides don't fit the screen anymore; sometimes the slides go to my desktop. tmux is working fine for me.
â Jander
Apr 25 at 16:44