SSH ing in one terminal and duplicating it

8,740

Solution 1

You can use Linux Screen to do what you need. It's a good tool to work with :)

Here is a good tutorial

Solution 2

Just install byobu, screen or tmux on the server. byobu is recommended since it is a wrapper script around screen (or tmux).

These are "command-line window managers" - with one SSH session you can open a lot of "windows", each window containing a shell, you can switch between them and all the software you are running still running even if you disconnect.

Try this on server:

sudo apt-get install byobu

then execute byobu, press <F2> to create more one window and <F3> and <F4> to navigate between windows. Press <Ctrl> + a + d to deattach your session (all your windows will keep running) - if byobu asks something to you, answer that you want to use screen-like keyboard shortcuts. Then, if you disconnect, reconnect and execute byobu again, you'll be in your last session, with all that windows.

Obviously, you can also use byobu locally and open only one terminal window (instead of tabs in your terminal application, like gnome-terminal, you'll have windows inside byobu).

Solution 3

You can clone your SSH session using the ControlMaster option in OpenSSH 4.0 (older versions does not support it). Check out this straight-forward tutorial.

Share:
8,740

Related videos on Youtube

howtechstuffworks
Author by

howtechstuffworks

Updated on September 18, 2022

Comments

  • howtechstuffworks
    howtechstuffworks over 1 year

    I usually have the habit of working with different terminal pointing to the same directory by opening different files. I sshed an server from one of my terminal from ubuntu and I had to do the same for all my terminals, is there a way where I can duplicate the terminals so that I don't need to connect on every terminal? Thanks, sorry if this is a duplicate, seems like an very common question.

  • howtechstuffworks
    howtechstuffworks about 12 years
    I tried Screen, its really good.... But I guess I kinda want to duplicate the image in different windows at the same time, i.e want to see all windows at the same time.
  • howtechstuffworks
    howtechstuffworks about 12 years
    I guess, byobu will create another screen. For Example, I ssh an server and then create an window using byobu/screen, then the window which I have right now will disappear, behind screen. But what I was looking for is,I SSH an server and then need to duplicate the window I have right now into antoher window in the client, So I will have two windows in the client and I can avoid sshing in another window to the same server. I usually work with 6-7 terminal windows open just to see the control flow, in case of C++. Thanks for your help.
  • Tristan
    Tristan over 7 years
    this looks to be a good answer but the link is dead
  • hovanessyan
    hovanessyan over 7 years
    Updated the link accordingly