January 06, 2009

Linux Screen command

I often find myself wanting to make changes to an application while I am also tailing the logs in order to view my changes in action. Up until recently I would start up two separate ssh sessions in order to accomplish this task. Of course I never bothered to think that this may be a common task which many people before me would seek to solve. Luckly I discovered the screen command. The screen command allows you to split your ssh session into various different sessions.

If your machine does not have screen installed, don't fret....


> sudo apt-get install screen


> sudo yum install screen

Now that we have screen installed we can run some simple commands which will prove to be valuable:

Start up the screen application:

> screen

Split the session into two:

> Control+a S

Change over to the second session:

> Control+a tab

Start the shell in the second session:

> Control+a c

You can switch between the sessions by typing:

> Control+a tab

You can find additional commands by using the man command or looking up the commands on the internet.