How to have a terminal mirrored onto a second screen in a two-monitor setup?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
25
down vote

favorite
4












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.







share|improve this question




















  • 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














up vote
25
down vote

favorite
4












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.







share|improve this question




















  • 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












up vote
25
down vote

favorite
4









up vote
25
down vote

favorite
4






4





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.







share|improve this question












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.









share|improve this question











share|improve this question




share|improve this question










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
















  • 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










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!).






share|improve this answer






















  • 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










  • @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

















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.






share|improve this answer


















  • 1




    Works perfectly! Thanks.
    – Jander
    Apr 25 at 16:40

















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.






share|improve this answer




















  • 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

















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.






share|improve this answer




















  • tmate looks interesting. Here is a simple demo: youtube.com/watch?v=is_VpIx3Z4M
    – pa4080
    Apr 26 at 16:14










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















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






























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!).






share|improve this answer






















  • 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










  • @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














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!).






share|improve this answer






















  • 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










  • @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












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!).






share|improve this answer














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!).







share|improve this answer














share|improve this answer



share|improve this answer








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 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










  • @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
















  • 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










  • @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















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












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.






share|improve this answer


















  • 1




    Works perfectly! Thanks.
    – Jander
    Apr 25 at 16:40














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.






share|improve this answer


















  • 1




    Works perfectly! Thanks.
    – Jander
    Apr 25 at 16:40












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.






share|improve this answer














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.







share|improve this answer














share|improve this answer



share|improve this answer








edited Apr 25 at 8:05

























answered Apr 24 at 17:20









pa4080

12k52255




12k52255







  • 1




    Works perfectly! Thanks.
    – Jander
    Apr 25 at 16:40












  • 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










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.






share|improve this answer




















  • 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














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.






share|improve this answer




















  • 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












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.






share|improve this answer












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.







share|improve this answer












share|improve this answer



share|improve this answer










answered Apr 24 at 17:11









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
















  • 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










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.






share|improve this answer




















  • tmate looks interesting. Here is a simple demo: youtube.com/watch?v=is_VpIx3Z4M
    – pa4080
    Apr 26 at 16:14














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.






share|improve this answer




















  • tmate looks interesting. Here is a simple demo: youtube.com/watch?v=is_VpIx3Z4M
    – pa4080
    Apr 26 at 16:14












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.






share|improve this answer












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.







share|improve this answer












share|improve this answer



share|improve this answer










answered Apr 26 at 16:01









pdr

1434




1434











  • 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




tmate looks interesting. Here is a simple demo: youtube.com/watch?v=is_VpIx3Z4M
– pa4080
Apr 26 at 16:14

















 

draft saved


draft discarded















































 


draft saved


draft discarded














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













































































Popular posts from this blog

pylint3 and pip3 broken

Missing snmpget and snmpwalk

How to enroll fingerprints to Ubuntu 17.10 with VFS491