On a linux server how do you use multiple terminals over a single ssh connection?
I often find myself opening several ssh connections in order to view several log files at a time with tail -f
.
This isn't a problem when I'm at home because I use public key encryption for password-less login. However, I will often use computer at my university to do this so I don't have the option of using my private key. It gets annoying to enter my password 4 or 5 times to get several terminal windows.
How can I get multiple terminals over a single connection?
Just use GNU screen, it's great as you can start up remote sessions and restore them if your connection drops. It's available as a package for most distributions and may even already be installed on your university system.
The manual will give you all you need to get started, by default all commands are preceeded by Ctrl+A
. For example to bring up the onscreen help, just press Ctrl+A
then press ?
screen allows you to have multiple terminals and more (such as the ability to detach and re-attach to your session).
Some notes to get you going:
Ctrl-a c create
Ctrl-a d detach
screen -r reattach
Ctrl-a a toggle
Ctrl-a " list
And some recommended reading:
- http://en.wikipedia.org/wiki/GNU_Screen
- http://jmcpherson.org/screen.html
- http://blogamundo.net/code/screen
- http://www.kuro5hin.org/story/2004/3/9/16838/14935