Developing with GNU Screen

I hear a lot say GNU Screen is better than Terminal’s tabs.

But I cannot find a real use case. I can understand that ability
to copy and paste is useful.

But in terms of session attaching/detaching, all the sessions
are gone if I restart my Mac.

I’m using Terminal with several tabs open (e.g., tail -f
development.log,
script/console, irb…)

I can use Command-Shift-] to move between tabs, but in
GNU Screen, I need to type Control-A n. To me, the latter
is more memorable and Mac-like.

I mostly develop locally and push the app to the server.
I never felt the need to sharing the session in GNU Screen.

I think I’m wrong in somewhere because a lot of people prefer
GNU Screen.

Can anybody explain the usefulness and what’s wrong in my view?

Jon Hunt

Hunt J. wrote:

I hear a lot say GNU Screen is better than Terminal’s tabs.

But I cannot find a real use case.
[…]

Not that this is a Rails issue, but…

Screen is great if you’re using a text-only environment (for example,
within an ssh session), or if you’re doing a lot of attaching and
detaching (ssh again?). I agree with you that for local sessions on a
graphical box, tabs in Terminal/iTerm/Konsole/whatever are nicer to deal
with.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

script/console, irb…)

Can anybody explain the usefulness and what’s wrong in my view?

I don’t think you’re doing anything wrong… screen loses a lot of
it’s usefulness when used locally. That said, I still use it on my
mac for a couple of reasons:

  • When I started Terminal didn’t support tabs. I hate having a ton of
    windows open.
  • I use iTerm and even then don’t like having a bunch of tabs open :slight_smile:

What I like about using screen is I’ve got an alias setup to read
a .screenrc file specifically for rails
(http://pastefree.pjkh.com/pastes/55
). This sets up 8 windows within screen and names them: controllers,
views, models, dbconsole, console, misc, javascripts, stylesheets,
server. The last one runs ./script/server. All the others do what
they are named. It makes jumping around quite nice. You’ll see in
the screenrc I don’t like CTRL-A so have remapped it to CTRL-]. That
doesn’t get in the way of vim as much. Yeah, I know there are plugins
to vim to make it more project like, but I’ve gotten too used to this
to change :slight_smile:

What I find useful about running it all locally via screen is that I
can start up a project with “railsscreen foo” and work on it. Then
detach it, and start up “railscreen bar” and work on that for awhile.
Then detach and reattach to foo and work on that. I hardly ever shut
off my mac so keeping this up and open is convenient. Also I
sometimes get a little happy with the CMD-Q combo and find I’ve quit
iTerm. But it doesn’t matter as screen lives on.

If you do end up using screen, on a mac, with vim, and iTerm you might
find this useful for getting 256 color support.
http://pjkh.com/articles/2008/07/09/osx-iterm-screen-vim-256-colors

-philip

Screen is valuable because you can start a session and then detach for
any period of time and then resume.

I’ve written about screen here:

http://www.ibm.com/developerworks/aix/library/au-gnu_screen/