Kuro5hin.org: technology and culture, from the trenches
create account | help/FAQ | contact | links | search | IRC | site news
[ Everything | Diaries | Technology | Science | Culture | Politics | Media | News | Internet | Op-Ed | Fiction | Meta | MLP ]
We need your support: buy an ad | premium membership

[P]
GNU Screen: an introduction and beginner's tutorial

By jeduthun in Technology
Wed Mar 10, 2004 at 07:23:33 PM EST
Tags: Software (all tags)
Software

Most modern Unix-based operating systems (e.g. Linux, MacOS X, and BSD) come with a little console-mode utility called GNU Screen. It's a powerful tool in the hands of the console warrior, a veritable Swiss Army knife of text-mode human-computer interaction.

This utility, despite its considerable usefulness, goes unused by a great many people. Why is this? Few people even know it's there, and those that do rarely understand the problem it solves. In this article, I will explain what screen does for you, and provide a simple set of instructions for accomplishing basic tasks using screen. My audience is those that are skilled with the command line but who have little or no experience with screen itself.


What screen does

Screen is best described as a terminal multiplexer. Using it, you can run any number of console-based applications--interactive command shells, curses-based applications, text editors, etc.--within a single terminal. The desire to do this is what gets most people hooked on screen. I used to start a half-dozen terminal emulators when I logged into my machine: I wanted one to read my email, one to edit my code, one to compile my code, one for my newsreader, one for a shell into my web host, and so on. Now I start one terminal emulator, and run screen in it. Problem solved.

The other main cool feature of screen is its ability to decouple the terminal emulator from the running programs. This means that you can use screen to keep programs running after you accidentally close the terminal emulator, or even after you log out, and later resume right where you were. It means that the idea of a "session" in which you are running a number of console programs is a free-floating entity that you can bind to any terminal anywhere, or no terminal at all if you want.

Getting started with screen: launching and switching between programs

Start screen just by typing screen at your favorite command shell prompt. You'll probably be greeted by a welcome message. Dismiss this and you'll have with an empty terminal containing a shell prompt, which is pretty much what you had before you started screen. What happened?

Every program running under screen runs in a window, and every window is identified by a unique number. Screen made a new window, numbered it 0, and started a command shell inside it. Type something in your new window so you'll be able to recognize it when you switch to it later.

Now make another window; this will be window 1. To do this, type C-a c; that is, type Ctrl-a and then type c (mnemonic: create window).

Now that you have two windows, try switching between them. To do this, type C-a C-a, which will switch you to whichever window you were using before the current one. Some other useful window switching methods, which you'll need if you plan to run more than two programs:

  1. Use C-a n and C-a p to switch to the next or previous window in the list, by number.
  2. Use C-a N, where N is a number from 0 to 9, to switch to the corresponding window.
  3. Use C-a " to get a full-screen list of windows. You can navigate this list with the arrow keys (or vi-style, with j and k), and pick a window to activate by pressing Enter when it's highlighted. C-a w will give you a small, non-interactive list of windows.

When you're using a window, type C-a A to give it a name. This name will be used in the window listing, and will help you remember what you're doing in each window when you start using a lot of windows.

Exiting the last program in a window will cause the window to disappear. You can also kill misbehaving programs with C-a K.

Detaching and reattaching: the magic of terminal decoupling

If you did the exercise above, you have successfully created a screen session. You can detach from this session by pressing C-a d. You can also detach just by closing the terminal emulator that contains the session. However, keep in mind that neither of these actually end your session. All they do is unbind your session from the current terminal. All of the programs you started running within screen are still running. Really.

Try it: just close whatever terminal emulator you were using to do the exercise above. Then log out, and log back in, if you desire. Start up a new terminal emulator, and type screen -r (the R, obviously, stands for "reattach"). You'll be right back where you were when you detached.

You can probably imagine a lot of good uses for this. You can start all your favorite console programs once and just leave them running in a persistent screen session. Some people have "screen uptimes" of several months.

One other good use for the detach and reattach is as a console-mode "remote desktop" feature. You can detach from a screen session at work, shell into the machine from home, and reattach. Very, very handy. With a bit of extra work, you can even have a number of terminals all attached to the same session--great for collaborative efforts and meetings.

Copying, pasting, and the scrollback buffer

Screen remembers a configurable number of scrollback lines, and you'll need them because you won't be able to use your terminal emulator's scroll features while running screen. You can access the scrollback buffer by entering "copy mode", which is accomplished by typing C-a [. You can mark text anywhere in the scrollback buffer and paste it with C-a ]. Screen is also capable of logging to files, but that's beyond the scope of this tutorial.

Monitoring for silence and activity

One of the disadvantages of running a bunch of programs within screen is that you can't keep an eye on all of them at the same time, since in general you can only see one at once. (Actually, you can split the screen and look at more than one at a time, but that's an advanced topic beyond the scope of this tutorial.) To help mitigate this problem, Screen has features that allow you to monitor a window for silence--useful for knowing when a compile has finished, for example--or activity--useful for knowing when someone is finally talking on your favorite IRC channel, for example.

To start or stop monitoring the current window for 30 seconds of silence, type C-a _; to start or stop monitoring a window for activity, type C-a M.

Making it go away

As you've seen from the section on detaching and reattaching, screen is not easy to kill. You can't just close its containing terminal. (Actually, you can, but then all those processes are still running on your system, ready to be reattached.) There's no "quit" key in the How do you fully exit screen?

To my knowledge, the only way to do this nicely (i.e. without sending nasty signals to processes that don't deserve it) is to close each of your screen windows. Exit whatever programs or shells each is running, and they will go away. When the last program running inside screen is exited, screen itself will go away.

Other stuff

Screen does much, much more than I've described above, but it's enough to get you started. You can type C-a ? for a terse list of commands available while you're in screen. The screen man page has a wealth of info, too. And here are some web resources, if you have questions:

Yahoo GNU Screen Group
A fairly high-traffic mailing list for screen. Many knowledgable people hang out here.

Sven Guckes' Screen Page
Another overview page; a good deal more terse than this one.

The official screen home page
No explanation needed here. The page is surprising sparse on details.

The screen man page
Nicely formatted and separated by section. Good reference. Be sure to check out the sections on using .screenrc to customize screen.

Screen FAQ
Not for newbies, but a good resource to dig into for troubleshooting.

Sponsors

Voxel dot net
o Managed Hosting
o VoxCAST Content Delivery
o Raw Infrastructure

Login

Poll
What is your experience with GNU Screen?
o I've never heard of it 18%
o Heard of it, never used it 29%
o Use it sometimes 20%
o Use it a lot 26%
o I don't like console programs 4%

Votes: 181
Results | Other Polls

Related Links
o Yahoo
o GNU Screen
o Yahoo GNU Screen Group
o Sven Guckes' Screen Page
o The official screen home page
o The screen man page
o Screen FAQ
o Also by jeduthun


Display: Sort:
GNU Screen: an introduction and beginner's tutorial | 196 comments (166 topical, 30 editorial, 5 hidden)
Comparing and contrasting? (2.50 / 8) (#1)
by Blarney on Tue Mar 09, 2004 at 04:15:41 PM EST

How does GNU Screen compare to, for example, the butt-simple terminal switching of ALT-Fn or CNTRL-ALT-Fn that Linux has? I find it much easier to switch screens that way when I'm working in text mode.

If you use ssh, screen is worth learning. (2.95 / 21) (#14)
by waxmop on Tue Mar 09, 2004 at 05:05:55 PM EST

Sure, at home, I use (and love) gnome-terminal because of its tabs and anti-aliased fonts. But at work and at school, I'm restricted to a ghetto ssh terminal connected to my home machine. And that's where screen really shines.

Screen is great for goofing off at work - in the first window, you've got inscrutable C code, and in the next, you're firing off resumes like mad.
--
We are a monoculture of horsecock. Liar

Run like hell... (2.12 / 24) (#18)
by elenchos on Tue Mar 09, 2004 at 06:35:28 PM EST

...whenever you see "GNU" anywhere in close proximity to the phrase "Swiss Army Knife". Trust me, no one has the time this thing is going to cost you.

Adequacy.org

long-term screen use (3.00 / 9) (#21)
by Baldrson Neutralizer on Tue Mar 09, 2004 at 06:54:15 PM EST

I have used screen for about 10 years, and there was a period where the constant ctrl-a contortions my left hand had to make caused some serious pain in my wrist. I finally clued in a remapped my control key back to the caps lock position (on a standard pc keyboard anyways) like a sun keyboard and the problem diminished greatly.

Also, I logged in to a linux machine a while back (I think it might have been red hat, not sure) and I noticed that the screen status bar was appearing in the title bar of my putty session. It was pretty cool. I never spent the time figuring out how to configure that setting on my own machines, but if anybody else knows how, it was a handy feature at the time.

Modern life, in EVERY ASPECT, is a cult of mediocrity.-trhurler

0, abstain (1.00 / 17) (#25)
by Hide The Hamster on Tue Mar 09, 2004 at 08:27:56 PM EST

+1FP,Technology, -1, GNU's Not Unix


Free spirits are a liability.

August 8, 2004: "it certainly is" and I had engaged in a homosexual tryst.

Another use (2.55 / 9) (#35)
by dn on Wed Mar 10, 2004 at 01:53:05 AM EST

Screen is also nice when, for whatever reason, your terminal keeps getting blown away. You don't have to keep putting all the editors, mail readers, and such back in order from scratch.

    I ♥
TOXIC
WASTE

-1: Please re-submit (1.03 / 33) (#36)
by I Hate Jesus on Wed Mar 10, 2004 at 01:56:00 AM EST

GNU/Please GNU/re-submit GNU/this GNU/in GNU/proper GNU/GNU GNU/speak GNU/approved by GNU/Richard GNU/Stallman.

Do you hate Jesus too?
Feh, screen. (2.81 / 11) (#52)
by zipper on Wed Mar 10, 2004 at 12:41:15 PM EST

Considering how few people use all the features of screen (and that it's huge) they ought to try dtach.

---
This account has been neutered by rusty and can no longer rate or post comments. Way to go fearless leader!
Screen + gnome-terminal + freebsd = T3H SUCX (2.20 / 5) (#56)
by IndianaTroll on Wed Mar 10, 2004 at 01:51:06 PM EST

Steps:
  1.  Open gnome-terminal
  2.  Ssh to freebsd server
  3.  start screen
  4.  BACKSPACE NOW PRODUCES ~

4 cannot be fixed.  Tried stty, tset, and others.  When I try the same thing except with xterm in step 1, everything works fine.

What is wrong with my gnome-terminal?

Why can I not use wonderful screen with wonderful BSD with wonderful gnome-terminal together?  Why must gnome-terminal look so pretty and suck so much backspace?


Your personal experiences don't mean diddly in a nation of 300 million people. jubal3

gnome-terminal + screen scrolling? (2.40 / 5) (#64)
by JahToasted on Wed Mar 10, 2004 at 04:22:01 PM EST

I would use screen all the time if it weren't for the fact that scrolling doesn't work at all with gnome-terminal.

Also the "New Screen" flashing up when you run screen -R is quite annoying. running with -q doesn't get rid of that message either.

It would be nice if I could have gnome-terminal open a new screen terminal if one doesn't exist or reattach to an already running one automatically when I click the icon. Then I could click on gnome-terminal, start a kernel compile, close gnome terminal, and open the terminal later to check on the status of the compile. But I guess the idea of using a GUI alongside the CLI never occured to the smelly GNU/Hippies.

Anyway its alright for ssh sessions I guess, but it could be much more useful.
______
"I wanna have my kicks before the whole shithouse goes up in flames" -- Jim Morrison

No point. (1.85 / 7) (#71)
by Phillip Asheo on Wed Mar 10, 2004 at 07:30:16 PM EST

Why not just run a couple of hundred Xterms and 9wm.

--
"Never say what you can grunt. Never grunt what you can wink. Never wink what you can nod, never nod what you can shrug, and don't shrug when it ain't necessary"
-Earl Long

This really doesn't sound that useful. (none / 2) (#74)
by lukme on Wed Mar 10, 2004 at 08:02:11 PM EST

personally, I perfer to have multiple terminal sessions opened. I position them in such a way that I know in this window I do a specific action based on its position. This follows how I normally do things, ie I sit down at my computer and do certain work there. I go to the kitchen and prepare a snack (I probably wouldn't want to cook anywhere near my computer). I go to the grocery store to buy food, which I certainly wouldn't do either in my kitchen or at my computer (I believe that the e-grocers have gone under, besides I live so far out, they wouldn't want to deliver to me anyway). Since I believe that this is a general metaphor as to how people work, opening just window with multiple terminal sessions would be confusing.


-----------------------------------
It's awfully hard to fly with eagles when you're a turkey.
Making it go away (none / 3) (#80)
by donio on Wed Mar 10, 2004 at 08:19:22 PM EST

C-a C-\ or if that doesn't work (because your terminal can't send
that sequence or something), C-a C-: quit [RET]

silly question (none / 3) (#84)
by clover_kicker on Wed Mar 10, 2004 at 08:48:47 PM EST

I'd like to configure screen(1)'s startup behaviour to automagically split the screen, running thisapp in one window and thatapp in the other, with the focus on thisapp.

Anyone know how I'd do this?
--
I am the very model of a K5 personality.
I intersperse obscenity with tedious banality.

What about jumping to the beginning of a command? (3.00 / 6) (#90)
by frankwork on Wed Mar 10, 2004 at 09:26:51 PM EST

In bash, and I'm assuming several other shells, C-a takes you to the beginning of the command line (C-e takes you to the end, most of these are just like emacs).

I just tried screen, and it doesn't preserve this behavior.

A couple of related shortcuts in bash -- C-p goes to the previous command (like up arrow, C-n is down arrow), C-r does a reverse i-search of your command history. C-_ undoes what you typed (but only the current, as yet unexecuted command line). C-f and C-b are like the right and left arrows, respectively, and M-f and M-b jump forward and backword a word at a time. M-d deletes a word (forward delete), C-d deletes a letter (likewise). C-k and C-y also work as you'd expect.

Note that many of these work in (of all places) Safari (no doubt due to its KHTML origins).

An awesome tool (3.00 / 13) (#93)
by Shibboleth on Wed Mar 10, 2004 at 10:24:59 PM EST

'Back in the day', when we used to be on dumb vt100 terminals in any one of a dozen labs at uni, screen was the Best Program Ever.

Its ability to switch and detach was beyond useful. For instance, we could be signed in on one server, coding, with one screen in Jove, another in a mail program, and another at a command prompt. We'd then have an ftp session going on a whole different server, and a MUD client or nethack game on yet another screen (on another server).

If some Authority Figure would walk in, a control-a, control-a would be enough to hide our nethack game from view. Best of all, if someone comes in, says 'everybody out, class about to start', you can just do a control-a-d, 'exit', and pick up your bag and leave, go to another lab, and resume precisely where you left off (except for the MUD, you were dead. :))

I still find it useful for my gentoo laptop. I have a root login, start screen, then start compiling some large program. Then I just detach the session, log out, and have a secure laptop sitting there compiling. If someone comes up to it, they can't just alt-function through the terminals and get a nice, open root session on screen.

xmx: A Screen-ish program for X (2.75 / 4) (#95)
by froindlaven on Wed Mar 10, 2004 at 11:21:28 PM EST

Here's a cool X program which is both an X client and server. You can attach/detach to it much like screen. I tried it out when I had to jump around from lab machine to lab machine and it worked pretty well. In the end, I opted for just using ssh and screen.

Screen on MacOS X (2.66 / 3) (#102)
by sakusha on Thu Mar 11, 2004 at 03:25:29 AM EST

screen is installed in MacOS X, I have FINK installed but I don't think I installed any GNU utils in FINK yet, it must come with the default OSX install.

But there really is no need for screen. Just download iTerm, it has multiple terminal management within one window.

http://iterm.sourceforge.net/

First thing I thought of (3.00 / 5) (#104)
by ragnarok on Thu Mar 11, 2004 at 03:43:08 AM EST

and what I continue to keep thinking, is, how useful for something like bochs, or Hercules, dosbox, or altair88, or other emulators/virtual machines.

If you're familiar with their operation, they tend to tie up a terminal, even if you've got multiple virtual terminals on your kde/gnome/whathaveyou X Window System window manager.

So you fire up screen, C-a c then fire up bochs running FreeBSD and it pops up the X Window displaying said OS, then C-a n and C-a c again, fire up vax simh.netbsd with ssh terminals, C-a n and C-a c again, fire up vm.sys which comes up with its own x3270 terminals, C-a n and C-a c again, fire up Basilisk II running Macintosh System 7.5, C-a n and C-a c again, and fire up the altair88 simh emulator running MP/M 2 with an ssh terminal, etc.

And because they can all be detached, that's one heap of desktop real-estate you won't worry aobut losing, while you can carry on learning and using various emulators to your heart's content.

Even better yet, you can make use of the various Xterms' multiple shell/session setups to do work on one Xterm's shell, while using screen plus emulators/virtual machines on yet another.

A geek's dream.


"And it came to healed until all the gift and pow, I, the Lord, to divide; wherefore behold, all yea, I was left alone....", Joseph Smith's evil twin sister's prophecies

Screen as poor guy's VNC (3.00 / 5) (#111)
by mikeymckay on Thu Mar 11, 2004 at 06:05:17 AM EST

My favorite feature of screen is being able to share a terminal with someone else in real time. It is a great way to collaborate on a project together, or to teach someone how to do various command line magic.

The great thing is that the command line is only text, so two users could be on a slow dialup connection but fully able to work together. It is like sharing a vnc connection, but needing just a fraction of the bandwidth.

To set this up you do something like this:

user1 runs screen
runs command "ctrl-A: multiuser on"
then "ctrl-A: acladd user2"

user 2 then runs
screen -x user1

(I think the above process may have changed slightly in recent versions due to some security issues)

Mike
www.vdomck.org

Splitvt... (none / 3) (#112)
by mikelist on Thu Mar 11, 2004 at 07:20:17 AM EST

is a similar idea, but both/all screens are visible simultaneously. I use that one more, screen is like having several vts logged in at the same time.

screen + bittorrent (3.00 / 5) (#113)
by davros4269 on Thu Mar 11, 2004 at 08:16:40 AM EST

Is a great combination.

I use btdownloadcurses and run it in a screen session. At this house, others use this machine, so if they log in, my downloads continue - when I log back in, I open a shell and: screen -r and I can see my progress.

This old crate really feels the bog when I have several downloads going, so I often use an even older crate with lots of ram and no hard drive - it runs Knoppix without X (knoppix 2). I SSH in and use screen so I can watch my downloads in their full ascii glory...

I also keep screen running on my firewall machine, an even older box, also without X running...

Screen is so much nicer than using, say, nohup or similar on a time-intensive command line job. I can't live without it.
Will you squirm when you are pecked? Quack.

How I use it (3.00 / 6) (#115)
by Piquan on Thu Mar 11, 2004 at 08:51:43 AM EST

Two tips from how I use screen.

First, if you use Emacs, or the Emacs bindings for bash, then you'll probably want to add escape ^Za to your .screenrc. This lets you use ^Z instead of ^A, so you can use Emacs more naturally. Who needs ^Z in screen anyway, and if you need it, ^Za will do the trick.

Second, I find screen great for multiuser collaboration. I'm helping a friend in his programming studies, usually over the phone. We'll often use a shared screen session, so we can watch each other work on code. The sequence is: he creates a screen session, hits (assuming ^Z is your escape char) ^Z:multiuser on[RET]^Z:acladd piquan[RET] (where my username is piquan); then I run (from a normal, non-screen terminal) screen -x jrh/ (where his username is jrh).

making it go away (none / 2) (#118)
by mikpos on Thu Mar 11, 2004 at 10:19:55 AM EST

C-a \ or C-a C-\ by default will kill screen and all its windows. However, in the default config file (this isn't nearly confusing enough), I believe these are rebound to do nothing, with a comment saying that they are "dangerous".

More .screenrc fun (3.00 / 7) (#121)
by fn0rd on Thu Mar 11, 2004 at 11:03:58 AM EST

#kill startup message
startup_message off

# define a bigger scrollback, default is 100 lines
defscrollback 1024

# on Debian backspace should send char `177':
bindkey -k kb stuff "177"

# An alternative hardstatus to display a bar at the bottom listing the
# windownames and highlighting the current windowname in blue. (This is only
# enabled if there is no hardstatus setting for your terminal)
hardstatus on
hardstatus alwayslastline
hardstatus string "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %m/%d %C%a "

# ------------------------------------------------------------------------------
# STARTUP SCREENS
# ------------------------------------------------------------------------------

# Example of automatically running some programs in windows on screen startup.
# Use the form: screen [-flag] [window name] [window number] [program to run in window]
# The -t flag means that the window in which that program is running
# closes when you exit that program, so if you quit pine
# window 2 closes.

screen bash
screen -t emacs 1 emacs
screen -t mail 2 pine
screen -t slashdot 3 lynx http://www.slashdot.org/
screen -t k5 4 lynx http://www.kuro5hin.org/
screen -t bar 5 ssh foo@bar

# I cribbed most of this from /etc/screenrc
# Check it out on your own to learn more about keybindings and whatnot.

This fatwa brought to you by the Agnostic Jihad

Modern day "detach" feature for GUIs... (3.00 / 4) (#122)
by bgarcia on Thu Mar 11, 2004 at 11:10:32 AM EST

If you like the idea of a "detach" feature, and wish it could apply to your X session or Windows machine, it is available.

VNC will allow you to view a desktop on any machine on a network. It can be very useful for working from home.

For the graphical crowd (none / 2) (#123)
by sleepingsquirrel on Thu Mar 11, 2004 at 11:22:19 AM EST

You might want to check into ratpoison. It does for xwindows what screen does for terminals...
"Ratpoison is a simple Window Manager with no fat library dependencies, no fancy graphics, no window decorations, and no rodent dependence."


Recursive screens... (3.00 / 8) (#134)
by Merc on Thu Mar 11, 2004 at 03:37:39 PM EST

Say I have a really flaky connection to a remote server. I want to run screen on it so if I get detached then I don't lose anything, right?

But screen's such a great program that I want to use it locally too, right? So what happens now when I use screen locally and connect to a remote machine, running screen there? I suppose I could have different escape characters, but that seems nasty. Does anybody deal with this situation?



And this brings up something else ... (2.57 / 7) (#136)
by pyramid termite on Thu Mar 11, 2004 at 04:25:10 PM EST

... I used to dual-boot between linux and windows for several years. I knew about console mode switching, I knew about xterms and I'd read several books and many, many documents.

This is a useful program. And yet, with my moderate experience and reading, I'd never heard of it. Even though I probably had it.

Conclusion? The linux world really needs to get its act together on documenting and explaining stuff if it wants to persuade the Micro$erf world to switch.

On the Internet, anyone can accuse you of being a dog.
I agree ;-) (3.00 / 4) (#138)
by dumky on Thu Mar 11, 2004 at 05:03:35 PM EST

I posted a similar story a month ago: Essential utility: "screen".
Screen is really an amazing program.
You can quit with 'C-a C-\' (from screen doc).


Yet more screen tricks. (3.00 / 7) (#148)
by static on Thu Mar 11, 2004 at 09:53:29 PM EST

First of all, a lot of readers don't realize that using screen to multiplex an xterm is actually a subtly different solution than starting a dozen xterms. The difference is that in screen you can select the screen you want directly. Doing that with all your xterms requires assistance from your window manager. Or a term program (like Konsole) that has tabbing et al.

Second: if you find yourself opening more and more screens, you might like the following commands in your .screen.rc.:

bind  ) select 10
bind  ! select 11
bind  @ select 12
bind \# select 13
bind \$ select 14
bind  % select 15
bind \^ select 16
bind  & select 17
bind  * select 18
bind  ) select 19

The default commands include Ctrl+a 5 to select screen 5; this makes Ctrl+a Shift+5 select screen 15. :-)

Last; although mention was made of the scrollback (Ctrl+A Esc), you can use this to copy-n-paste between screens. Look in the screens manpage* for details but if you use vim you might like this instead of the default:

# Prepend/append register [/] to the paste if ^a^] is pressed.
# This lets me have autoindent modes in vi(m).
register [ "\033:se paste\015a"
register ] "\033:se nopaste\015a"
bind ^] paste [.]

The defaults toggle autoindent mode but that's not always sufficient. And vim's paste mode is actually designed for this.

Wade.

* unlike so much other GNU software, the man page is really quite good and doesn't point you to an info page.


Wish for somthing else (1.40 / 5) (#158)
by n8f8 on Fri Mar 12, 2004 at 09:45:29 AM EST

Like a damn widget for changing the screen resolution on a notebook. And even better, make it so a user can right click on the desktop to access it.

Sig: (This will get posted after your comments)
reminds me of windows xp (1.00 / 8) (#169)
by auraslip on Sat Mar 13, 2004 at 02:08:24 AM EST


124
How to map Ctrl-Tab? (none / 1) (#171)
by BranchingLichen on Sun Mar 14, 2004 at 12:06:16 AM EST

Rather than using Ctrl-A N and Ctrl-A P, I'd like to use Ctrl-Tab and Ctrl-Shift-Tab to switch to the next / previous screen.

Does anybody know how to do this?

Ctrl-Tab would be nicely consistent with many other applications, e.g. switching the active tab in Mozilla. A general standard in Microsoft Windows and many other environments is: Alt-Tab changes the application, Ctrl-Tab changes within an application.



Trick for transfering files using only terminal. (3.00 / 5) (#173)
by Tezcatlipoca on Sun Mar 14, 2004 at 07:39:35 PM EST

That is right, you have two machines, you only have access to the terminal servers through serial lines (not uncommon in modern datacenters) and you need to transfer medium sized files (don't try this wirh your 100GB MP3 collection).

Using screen define a new buffer file, then use uuencode in the first machine:

uuencode file file

and go to sleep.

Next day (or week :-) )  go to the next machine and try:

cat - <<EOF >> file.uu

at this point type Ctrl-a ] which pastes screen's buffer, once finished type EOF and CTRL-D

now you can

uudecode file.uu

and you get your file in all its glory.

This trick saved me one week of internal bureaucracy....

Might is right
Freedom? Which freedom?

wooWOO (2.50 / 2) (#177)
by pytholyx on Mon Mar 15, 2004 at 01:56:29 PM EST

I had a friend who couldn't shut up about this, and told me I'd love it. I've been waiting for an overview like this to be delivered right to me, I guess. Best. Program. Ever. Can't be a console ninja without this.

Desirability follows utility.
Kinda sorta like gnuserv (none / 0) (#179)
by Akhasha on Wed Mar 17, 2004 at 01:20:29 AM EST

I have an emacs habit and also couldn't live without screen. Emacs has a sorta-similar function called gnuserv, so you start it up somewhere (possibly either using nohup or in a screen session), run gnuserv-start or have it in your .emacs/custom.el. Then either background it or detach from the screen session, and from elsewhere you can access the same editing session with all the buffers preserved by logging into that machine and running gnuclient. Even though the way I run it, emacs is running in a terminal, if DISPLAY is set in the terminal running gnuclient, you get an X window. Its not entirely perfect, I've occasionally seen xemacs lock up running this way, but in general it has saved me a lot of bother and gives me a persistent development environment whereever I can ssh onto the net. Just remember that C-x C-c will exit the parent emacs, when you want to exit your editing window and leave the remote editor running use C-x 5 0

There is however one big fat caveat with using screen on linux, I have had my beautiful, 15 odd terminal screen session lock up irretrievably more than once in the past. The closest I got to tracking down the bug was some comments in a kernel list mentioning an obscure bug in the pty driver code. That may have been resolved as it hasn't happened in 6 months and I use screen every day.



my screenrc (none / 0) (#182)
by freddie on Wed Mar 17, 2004 at 04:51:09 PM EST

Using control-A messes up bash line editing, i prefer to use control-t instead

shell /bin/bash
escape ^Tt



Imagination is more important than knowledge. -- Albert Einstein

Screen under cygwin on windows (none / 1) (#185)
by askey on Fri Mar 19, 2004 at 07:06:15 AM EST

Does it work under cygwin on windows?

Blast from the Past (none / 0) (#186)
by Waldo on Sun Mar 21, 2004 at 02:17:43 AM EST

screen was the way to go back when SLIP was the preferred method of connecting to the Internet, the WWW was just some thing Tim BL was playing with at CERN, and command-line access was the only way to fly.  I could initiate a zmodem transfer to transfer a file onto my home computer while downloading a file through FTP to my shell account and also running a search in WAIS.  It was totally cool.

But...uh...that was 1992.  Now, I have a GUI.  No screen for me.

-Waldo Jaquith

screen is essential for heavy irc use (none / 0) (#189)
by akuzi on Thu Apr 01, 2004 at 06:45:32 PM EST

It lets you sit on an irc channel forever and yet connect in from anywhere on the net, scroll back to set what has been happening on the channel etc.

Run bitchX or irc2 under a screen session on a stable server that you can ssh to. Then detach and reattach whenever you need to.

Detaching sessions (none / 0) (#191)
by tim on Fri Apr 16, 2004 at 04:31:31 PM EST

I absolutely loved screen back in my university days.  I would be hacking at the lab at school until it was late enough that I wanted to go home.  Then I would just detach my screen, go home, login and reattach the screen and I would be right back in the same place.  Sadly I don't find much use for it these days.
... --- ...
GNU screen and SSH (none / 0) (#192)
by tbc on Tue Apr 20, 2004 at 04:26:04 PM EST

See my writeup at my blog: GNU screen and SSH

funny (none / 1) (#193)
by keleyu on Mon Mar 21, 2005 at 02:42:27 AM EST

lyrics lyrics

Shameless plug of another HowTo (none / 1) (#195)
by cprior on Tue Nov 29, 2005 at 06:43:30 AM EST

http://gentoo-wiki.com/TIP_Using_screen

Different to all those text-based HowTos I tried to visualize GNU Screen as well: Towards the end of the HowTo there is an animated .gif If you find something improvable, please do not hesitate to do so!

GNU Screen: an introduction and beginner's tutorial | 196 comments (166 topical, 30 editorial, 5 hidden)
Display: Sort:

kuro5hin.org

[XML]
All trademarks and copyrights on this page are owned by their respective companies. The Rest © 2000 - Present Kuro5hin.org Inc.
See our legalese page for copyright policies. Please also read our Privacy Policy.
Kuro5hin.org is powered by Free Software, including Apache, Perl, and Linux, The Scoop Engine that runs this site is freely available, under the terms of the GPL.
Need some help? Email help@kuro5hin.org.
My heart's the long stairs.

Powered by Scoop create account | help/FAQ | mission | links | search | IRC | YOU choose the stories!