Friday, April 24, 2009

The Preferred Cygwin Screen Version

Screen should be among the top 10 unix tools you learn. If you have access to a shell account, learn it. Master it. It will save your butt.

On Windows, I've been using this port of screen for years.

But, while poking through the Cygwin 1.7 beta, I learned that it now gives you the option of install screen. You'll find it under Utilities, here:

The cool part about using the latest Cygwin version is that attaching and dettaching from a screen session seem to work flawlessly. Finally, I can screen -rd my way back to all screens if need be.

6 comments:

  1. Anonymous4:55 PM

    Here's something similar for cmd.exe:

    http://sourceforge.net/projects/console/

    For those occasions when rxvt.exe and bash.exe are sluggish enough to be annoying.

    -alex

    ReplyDelete
  2. Thanks for the tip.

    Luckily, I haven't had any sluggish issues with rxvt or bash. But still, good to know.

    -Ben

    ReplyDelete
  3. Ben what is the use case where Screen wins out over multiple terminals?

    ReplyDelete
  4. Grant -

    You mean screen versus opening up multiple xterm's, rxvt's or cmd's?

    Good question. A few things come to mind:

    1) You can open up quite a few screen sessions without losing any realestate (I'll easily have 5 - 10 open. 5-10 extra windows would be a pain).

    2) You can switch between the terminals quite quickly and reliably. Hitting alt-tab works, but not nearly as well.

    3) And this is the key one - you can resume sessions that have been disconnected. So, if you ssh to a Linux box, have some thing you were working and lose the connection. You can resume right where you left off. Just ssh back to the server and reconnect to the screen session.

    The windows version does this too. So, if you've got a cygwin shell open and accidentally kill it, you can open a new one and reconnect to your past screen session.

    Does that answer your question?

    -Ben

    ReplyDelete
  5. Yes. Understood. Thanks.

    ReplyDelete
  6. Anonymous8:42 AM

    I can't find solution on the net. Maybe you can. I install the latest cygwin & screen on XP. I can initiate screen and detached but can't reattach.

    $ screen -S test1
    [detached]

    tx@Ria /tmp/uscreens/S-tx
    $ ls
    724.test1

    $ screen -r 724.test1
    There is a screen on:
    There is no screen to be resumed matching 724.test1.

    $ ps
    PID PPID PGID WINPID TTY UID STIME COMMAND
    4016 2420 4016 3068 0 1007 08:10:36 /usr/bin/bash
    724 1 724 724 ? 1007 08:28:23 /usr/bin/screen
    I 3308 724 3308 1812 1 1007 08:28:23 /usr/bin/bash
    2564 4016 2564 2584 0 1007 08:32:20 /usr/bin/ps

    it is there on process list but tty is UNSPECIFIED.

    if I screen without -S, it shows PID.tty0.HOST on /tmp/uscreens/S- but still can't reattach.

    Usually on linux, screen -r PID is fine.

    Thanks for your help. My first time on cygwin.

    ReplyDelete