Tuesday, June 15, 2010

GNU Screen

It has been two years since I switched to linux from windows. And ever since the first day, I liked linux and liking linux more day by day. I use mainly vi to edit files (especially program files) on the terminal. Sometimes, I feel the need of several terminals. Present linux desktops provide tab based terminal interface which served my need for a while. But switching between the tabs takes times and not that convenient. I wasn't satisfied with it. I was hoping for some tools to give me an interface like vi where I can split to multiple windows, hide windows, switch between windows easily. And it would be very good to be able to make sessions and use them as I use buffers in vi. Guess what, I just found that tool of my dream. Its the "GNU screen". Its really amazing. It gave me everything that I wanted for. Here are some of the features of screen.
  1. Create multiple sessions, switch between the session
  2. Split the window into several windows, switch between the windows
  3. Copy/paste region of text on the screen without using mouse. I couldn't do it on conventional terminal.
  4. Detach session and attach the session again. In this way you can save your session and use it in later time. Its like the vncserver.
  5. And many more.....
One problem I had with the screen is its default escape keystroke which is Ctrl-A. I use Ctrl-A a lot to move to the beginning of a line in command line and emacs. I need this key stroke very much. But, screen is customizable and you can remap the keystrokes. So, I mapped the escape command to Ctrl-U. I did this by adding the following line in the .screenrc file.
escape ^Uu
Next, I wanted to use the j,k keys to move between the windows and did this by adding the following lines.
bind j focus down
bind k focus up
bind t focus top
bind b focus bottom
I wish to write a lot about the screen but because of my shortage of time, I would like to refer to the following site.
http://www.gnu.org/software/screen/