If you’ve spent hours on a task, such as debugging an application, it can be maddening to lose your work in an instant. This article shows you how to keep your shell and your work alive, even across multiple sessions and dropped connections using GNU Screen. Screen is a remarkable tool that you will quickly find invaluable in any work you perform on the command line. In fact, use it once, and you will wonder how you ever lived without it.
Stayin’ Alive with GNU Screen
About The Author
Follow me on Twitter @thomholwerda
2009-02-12 12:31 amtheosib
Can you give an example?
2009-02-12 1:29 amBill Shooter of Bul
Regular message => nethack message
“Copy mode aborted”=>”You escaped the dungeon.”
“Filter removed.”=>”You have a sad feeling for a moment…”
“Window %d (%s) killed.”=>”You destroy poor window %d (%s).”
“Detach aborted.”=>”The blast of disintegration whizzes by you!”
“Aborted because of window size change.”=>”KAABLAMM!!! You triggered a land mine!”
“There are several screens on:”=>
“Prove thyself worthy or perish:”
2009-02-16 11:08 pmbackdoc
I agree with this article, screen is a godsend especially when dealing with remote systems. The copy/paste feature alone is worth it on local consoles as well, though they didn’t cover that in the article. It can also be used very effectively as a serial terminal, if you ever need a quick and dirty serial connection to a headless box.
2009-02-12 9:16 amskypher
Yeah, tmux is a cool alternative since 0.7.
2009-02-12 8:57 pmapotheon
Hell yes. I much prefer tmux over GNU Screen — for its licensing, its interface, its client/server architecture, its stability, and its lightweight design. GNU Screen has a few features that tmux lacks, but those features may as well not exist, considering the way I use a terminal multiplexer.
2009-02-12 10:03 pmphoenix
The nicest thing I like about tmux compared to screen, is that out-of-the-box, the keybindings don’t mess up CLI navigation. ie CTRL+A still means “beginning of line” and not “enter command mode”. Once less thing to configure on all the servers.
Now, if only someone would port it to Debian.
2009-02-13 3:38 amBSDfan
Compile it yourself? it should work on Linux.. BSD.. any Unix worth using.
For debian specifically, google relieved this:
It’s outdated though, just compile it yourself.
2009-02-16 11:11 pmbackdoc
macbook-pro:~ backdoc$ tmux
-bash: tmux: command not found
Screen is one of my all time favorite *nix programs. ever.
I love it. It is unbelievably useful, specially when having to deal with remote systems.
screen is an awesome program. Use it on a daily basis and work would be a lot more messy if I had to open separate terminals instead of just running screen.
I always wanted something like this, once tried screen, but had to little patience to read the manual. So I got stuck. This article revived that idea and now I’m screen’s fan. Especially split window mode and copy/paste.
2009-02-16 11:23 pmbackdoc
Pick 3 or 4 things to use. It can be overwhelming to try to learn everything. Here’s my favorites:
While in screen:
Ctrl+c (create new session)
Ctrl+A (rename session)
Ctrl+” (show list of current sessions)
Ctrl+a,Ctrl+a (switch between current session and last one)
From the shell:
screen -ls (show current screen processes)
screen -dr <process> (detach then reattach to “process”)
If you just get used to using these, they will pay dividends. I’ll bet that there are more that I would love, if I knew them. But, I just stick with a few favs and they work for me. If you use the command line (which you should), you’ll be amazed how these few commands will increase your productivity and satisfaction.
It is a lovely program to use, especially if you run a big job on a cluster. I was talking to a geologist about best practices running programs on a Linux cluster and when I told him about screen and how it works he immediately got on the phone and was telling his friend about it.
My favorite option From the man page
Changes the kind of error messages used by screen. When you are familiar with the game “nethack”, you may enjoy the nethack-style
messages which will often blur the facts a little, but are much funnier to read. Anyway, standard messages often tend to be unclear as
This option is only available if screen was compiled with the NETHACK flag defined. The default setting is then determined by the
presence of the environment variable $NETHACKOPTIONS.