Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GNUScreen
- ---------
- Screen is to the console what your window manager is to X. It will allow you to have several
- buffers or windows running at the same time, you can easily switch from one buffer to another,
- copy and paste between them, create new windows and close others, etc. Each new window will
- launch a new process defined by the configuration, typically an interactive shell. But that is
- not all. Probably the better feature is that it runs as a separated process from the X server,
- though, you can get connected to it from a Terminal window running on top of X. We will return
- to this topic later.
- Now we'll going to do a tour though most useful screen features, from basic ones to some cute
- configurations that can make your life easier understanding screen.
- Launching Screen
- ----------------
- This one is easy, from a console type "screen" (without quotes) and press enter. This is a way
- to launch screen, we will see later we can do some cool stuff using the screen command, but for
- now, this is the basic way to start screen.
- Basic usage
- -----------
- First some conventions, as many Unix manuals, <c-X> stands for a keyboard shortcut using the
- CONTROL key and the "X" key.
- The way to communicate with screen is typing a prefix -<c-a> by default- and then pressing a
- key.
- <c-a> c -> *C*reates a new *C*onsole window
- <c-a> n -> *N*ext tab or window
- <c-a> <space> -> next tab
- <c-a> <Return> -> next tab
- <c-a> p -> *P*revious tab
- <c-a> S -> *S*plit screen
- <c-a> <Tab> -> focus next frame
- <c-a> Q -> make current frame the only one
- <c-a> K -> **K**ill current application
- <c-a> ? -> Shows all commands (really helpful)
- <c-a> w -> Shows a list of current running tabs
- Those are the basics keys used by navigate through the different "tabs" or "windows". They are
- pretty easy to use. Suppose you are downloading something with wget. It is boring to watch the
- download progress, so you want to do something else. Press <c-a> c to create a new terminal and
- launch whatever you want from there. If you want to check the download, just press <c-a> p to go
- to the previous tab, and <c-a> n to back to your funny stuff. You can use this features in TUI
- mode, or in GUI mode from a terminal window as well.
- Detaching and reattaching
- --------------------------
- One of greatest screen's feature is the ability to detach itself from the current terminal
- application that's running in (xterm, putty or whatever). We said already Screen runs as a
- separated process from X, this is why that is so great. If you want to restart the X server, or
- some X application makes it to crash, all the programs and processes running on Screen will keep
- going. If you are working over a ssh connection and you suddenly suffer network problems, the
- processes you started from Screen over ssh will keep going too. If you have no problem at all
- but for some reason you want to detach your terminal and reattach it from another place, Screen
- will let you do it.
- We can see an example, the usual work flow when using ssh should be:
- Connect to the remote machine (using ssh, putty,...). Then start a screen session. Open as many
- consoles as you want. If your connection falls, normally you would loose all unsaved changes and
- current processes would be killed in a rude way. Not to talk if you were compiling/executing
- something that would last several hours...So much work lost!
- That's what you could think at first, but screen has a very powerful feature
- called 'detach'. When something goes wrong with your connection, or you click
- that 'X' at the corner window, screen just detaches itself from the containing
- window, but none of your work is lost. It keeps running at the background. you
- can try playing some music with mplayer, and closing the terminal containing it
- and keep listening music.
- When you're on a system without X, and you have no 'x' to click (or nested
- screens), you can detach screen with the next command:
- <c-a> d -> *d*etach screen
- Now if you want to recover (reattach) your screen session you just open a
- terminal and enter the command:
- screen -r
- I personally use screen -DR that forces a reattach and it even detaches it if
- it was active somewhere else.
- If you have more than one screen detached, you have to provide info about
- which screen session you want to recover.
- kidd@raymobil [ ~ ] %screen -ls
- There are screens on:
- 2945.pts-0.raymobil (Attached)
- 1558.pts-8.raymobil (Detached)
- 2 Sockets in /tmp/uscreens/S-kidd.
- Then you can decide which one you want.
- screen -r 29
- will do the job. (unique substring)
- Multiuser
- ---------
- screen -x pid
- copy mode
- ---------
- With screen you can copy and paste text between buffers in the same session.
- It's done only with the keyboard (pretty useful if you have to paste text from
- a terminal to an IRC channel to get help on how to recover your X).
- <c-a> <esc> -> enters 'copy mode'.
- Once in copy mode, you can move around your window with hjkl (vi movement keys), arrow keys, or
- page-up and page-down. Once in copy mode, press <space> to start the selection. Use the movement
- keys to select the desired text and press <space> again to exit the selection mode. Now you
- have the text copied and ready to be pasted where you want.
- <c-a> ] pastes the copied text onto current buffer.
- screen provides a way so search text in the scroll buffer, guess what? it's the
- vi style ;)
- c-a <esc> ?text<Return>
- options, binds and beautifying
- ------------------------------
- .screenrc
- ---------
- making screen collaborate with other apps
- -----------------------------------------
- Making zsh set titles dynamically
Add Comment
Please, Sign In to add comment