Screen - The Terminal Windows Manger - The Awesome!

First, here is a good tutorial for using Screen:

Screen is great for keeping long running processes running.  This is especially useful if you are ssh'ed into a server.  But, I know people who live in Screen even locally.  Not sure what the benefit is of that.  But, to each his own.

Some Screen Commands

Whenever you see something like "ctrl+a, c", that means "ctrl+a" then press "c".

From the command line:

  • screen => Starts screen
  • screen -R => (Note that this is run from the command line, not from within screen.)  Re-attach all open screen windows.  This will re-attach you to the sweet processes running in screen.
  • screen -ls => Lists the currently running screen sessions.

From within a Screen session:

  • ctrl+a, c =>  starts a new screen shell (or window)
  • ctrl+a, p => go to previous window
  • ctrl+a, n => go to next window
  • ctrl+<number> => Each of your Screen windows are given a number.  You can navigate to one with this key binding.
  • ctrl+a, " =>  list all the active screen windows.  use "j" and "k" to navigate up and down the list.  hit enter to choose a window.  may be able to use the up or down arrow.
  • ctrl+a, shift+a => rename the screen window.  This is key.  I rename all my active Screen windows to something descriptive, such as "Mongrel Log" for the log file I am tailing.
  • ctrl+a, k => kill the current window.  This will kill any processes in that window.
  • ctrl+a, \ => kill all the windows
  • ctrl+a, d => detach screen.  This will remove you from screen.  But, all the screen windows you had active (which are running sweet processes) will still be running.

Fix the delete key issue

On my mac, the "delete" key does not delete when in screen.  You need to do this to fix it. On the system from which the screen command will be run, add the following line to the ~/.bashrc file.

alias screen='TERM=screen screen'

Make sure the restart the user's shell session.

.screenrc file

Create one of these in your ~ directory.  Anyone have a really sweet one?  Please share.

I don't have a lot of Screen customizations.  But, the one I must have is this one.  See the image below.

Here is what you need in order to get that:

hardstatus alwayslastline "%{= wk}%H | %-w%{+u r}%n %t%{= wk}%+w%{= wk}"

20081017.1 cnuapp@fatjade: /export/web

Posted via web from Structurally Sound Treehouse

About this entry