Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What must I know to use GNU Screen properly? [closed]

Tags:

gnu-screen

I've just introduced a friend to GNU Screen and they're having a hard time getting used to it. That makes me think about the essential things he needs to know about the excellent Screen utility, the same things that you'd think worthwhile to teach someone, a beginner, from the ground up. What are some analogies and handy tips for remembering binds, etc.?

It would be awesome.

like image 940
Henry B Avatar asked Sep 16 '08 09:09

Henry B


People also ask

When should I use GNU Screen?

GNU Screen is a terminal multiplexer, a software application that can be used to multiplex several virtual consoles, allowing a user to access multiple separate login sessions inside a single terminal window, or detach and reattach sessions from a terminal.

How do I exit GNU Screen?

If you exit screen, by typing exit, you lose that session. To detach it, type Ctrl-a Ctrl-d (most commands in screen start with Ctrl-a, this overrides the Ctrl-a command normally used when you want to jump to the start of a line).

What is the command used for easy using of GNU Screen?

Log files of current screen sessions can be started with the Ctrl+a H command, which will make a file called screenlog. X where X is the number of your screen session. A screenshot of what is currently in your screen window can be invoked with Ctrl+a h, creating a file called hardcopy.

How do I open GNU Screen?

To open a new window, press Ctrl+A, release, and then press c. This creates a new window on top of your existing window.


2 Answers

I've been using Screen for over 10 years and probably use less than half the features. So it's definitely not necessary to learn all its features right away (and I wouldn't recommend trying). My day-to-day commands are:

^A ^W - window list, where am I ^A ^C - create new window ^A space - next window ^A p - previous window ^A ^A - switch to previous screen (toggle) ^A [0-9] - go to window [0-9] ^A esc - copy mode, which I use for scrollback 

I think that's it. I sometimes use the split screen features, but certainly not daily. The other tip is if screen seems to have locked up because you hit some random key combination by accident, do both ^Q and ^A ^Q to try to unlock it.

like image 159
Greg Hewgill Avatar answered Oct 12 '22 05:10

Greg Hewgill


I couldn't get used to screen until I found a way to set a 'status bar' at the bottom of the screen that shows what 'tab' or 'virtual screen' you're on and which other ones there are. Here is my setup:

[roel@roel ~]$ cat .screenrc # Here comes the pain... caption always "%{=b dw}:%{-b dw}:%{=b dk}[ %{-b dw}%{-b dg}$USER%{-b dw}@%{-b dg}%H %{=b dk}] [ %= %?%{-b dg}%-Lw%?%{+b dk}(%{+b dw}%n:%t%{+b dk})%?(%u)%?%{-b dw}%?%{-b dg}%+Lw%? %{=b dk}]%{-b dw}:%{+b dw}:"  backtick 2 5 5 $HOME/scripts/meminfo hardstatus alwayslastline "%{+b dw}:%{-b dw}:%{+b dk}[%{-b dg} %0C:%s%a %{=b dk}]-[   %{-b dw}Load%{+b dk}:%{-b dg}%l %{+b dk}] [%{-b dg}%2`%{+b dk}] %=[ %{-b dg}%1`%{=b dk} ]%{-b dw}:%{+b dw}:%<"  sorendition "-b dw" [roel@roel ~]$ cat ~/scripts/meminfo #!/bin/sh RAM=`cat /proc/meminfo | grep "MemFree" | awk -F" " '{print $2}'` SWAP=`cat /proc/meminfo | grep "SwapFree" | awk -F" " '{print $2}'` echo -n "${RAM}kb/ram ${SWAP}kb/swap" [roel@roel ~]$ 
like image 24
Roel Avatar answered Oct 12 '22 05:10

Roel