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.


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

Here is a good tutorial

  • 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 Apr 1 '12 at 1:44

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

  • 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. – howtechstuffworks Apr 3 '12 at 21:58

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.

  • this looks to be a good answer but the link is dead – Tristan Oct 24 '16 at 3:22
  • Updated the link accordingly – hovanessyan Oct 24 '16 at 7:11

Tmux/screen is fine, but it's kind of uncomfortable to have multiple terminals in a window manager in a terminal in a window manager, the inner window manager being tmux/screen.

What I do for this is having keybindings that launch terminals that ssh to the systems I most commonly connect to. So, for example, pressing Super+F5 would execute urxvt -e ssh common-server-1.

Because I got keys set up for these systems, I only need to input my key decryption password for the first terminal, and it stays cached long enough to launch other terminals that immediately go to the remote system's shell prompt.

To quickly get them all on the same directory, I make use of shell history. The directory I want is typically the last one I went to, so I just cd Ctrl+pEnter and I'm there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.