PLiKhost Web Blog

01 Sep, 2010

Keep Your SSH Session Running when You Disconnect

Posted by: Ahmandonk In: How to?|Server Administration

Screen is like a window manager for your console. It will allow you to keep multiple terminal sessions running and easily switch between them. It also protects you from disconnection, because the screen session doesn’t end when you get disconnected.

You’ll need to make sure that screen is installed on the server you are connecting to. If that server is Ubuntu or Debian, just use this command:

sudo apt-get install screen

Now you can start a new screen session by just typing screen at the command line. You’ll be shown some information about screen. Hit enter, and you’ll be at a normal prompt.

To disconnect (but leave the session running)

Hit Ctrl + A and then Ctrl + D in immediate succession. You will see the message [detached]

To reconnect to an already running session

screen -r

To reconnect to an existing session, or create a new one if none exists

screen -D -r

To create a new window inside of a running screen session

Hit Ctrl + A and then C in immediate succession. You will see a new prompt.

To switch from one screen window to another

Hit Ctrl + A and then Ctrl + A in immediate succession.

To list open screen windows

Hit Ctrl + A and then W in immediate succession

There’s lots of other commands, but those are the ones I use the most.

No Responses to "Keep Your SSH Session Running when You Disconnect"

Comments are closed.

About this blog

Blog ini di dedikasikan untuk client PLiKhost ataupun calon client PLiKhost, sebagai sarana pusat informasi dan pertukaran informasi sesama client maupun calon client kami. Pada blog ini akan kami sampaikan informasi penting dan terkini yang terjadi di PLiKhost Web Hosting. Semoga blog ini berkenan bagi semua yang membacanya.

Calendar

September 2010
M T W T F S S
« Aug   Oct »
 12345
6789101112
13141516171819
20212223242526
27282930