(from the man page)
Screen is a full-screen window manager that multiplexes a physical terminal between several processes (typically interactive shells). Each virtual terminal provides the functions of a DEC VT100 terminal and, in addition, several control functions from the ISO 6429 (ECMA 48, ANSI X3.64) and ISO 2022 standards (e.g. insert/delete line and support for multiple character sets). There is a scrollback history buffer for each virtual terminal and a copy-and-paste mechanism that allows moving text regions between windows.
When screen is called, it creates a single window with a shell in it (or the specified command) and then gets out of your way so that you can use the program as you normally would. Then, at any time, you can create new (full-screen) windows with other programs in them (including more shells), kill existing windows, view a list of windows, turn output logging on and off, copy-and-paste text between windows, view the scrollback history, switch between windows in whatever manner you wish, etc. All windows run their programs completely independent of each other. Programs continue to run when their window is currently not visible and even when the whole screen session is detached from the user’s terminal. When a program terminates, screen (per default) kills the window that contained it. If this window was in the foreground, the display switches to the previous window; if none are left, screen exits.
Screen is available in many distributions, in Ubuntu is included in the base installation.
How to use Screen
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).
Switch from a windows to the other
- Use C-a n and C-a p to switch to the next or previous window in the list, by number.
- Use C-a N, where N is a number from 0 to 9, to switch to the corresponding window.
- Use C-a ” to get a full-screen list of windows. You can navigate this list with the arrow keys, and pick a window to activate by pressing Enter when it’s highlighted.
- Use C-a ‘ to have a prompt “switch to window” type the number of the window you want to switch on.
Name a window
use C-a A to give a name to current window otherwise you’ll have all windows with the same name (in my case it was “shell”)
Close a 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
You can detach from a 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.
After the detach now 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.
One 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.
Another very interesting use of the screen is what makes it possible to split the screen into regions.
With C-a S (split) will create a new horizontal zone. This area initially will not contain anything, but you can move the focus there with C-a <tab> and then activate a window in this region with a command to switch windows as C-a N.
I make use of this option to have in the upper half of the screen a tail -f of a log file and at the bottom i give commands that interact with that particular demon or process.
If you prefer a vertical division of the windows you can use C-a |, which will do exactly the same thing but by dividing the screen into two regions with a vertical dividing line.
For an online help check C-a ?
Check also http://www.kuro5hin.org/story/2004/3/9/16838/14935 a 2004 tutorial, but still good.
Byobu is a Japanese term for decorative, multi-panel screens that serve as folding room dividers. As an open source project, Byobu is an elegant enhancement of the otherwise functional, plain, practical GNU Screen. Byobu includes an enhanced profile and configuration utilities for the GNU screen window manager, such as toggle-able system status notifications.
Let’s look at the information Byobu provides. The bottom row of Byobu contains, from left to right, your Distribution logo and name, uptime, load, cpu frequencies, ram amount and usage, and the date. You could have different info, like total number of processes or network statistics, these info are highly configurable.
Default F keys:
F2 to create a new window. Along the bottom of the screen you’ll now see two entries in the top row of the footer.
F3 to move to the previous window
F4 to move to the next window.
F6 to detach from window.
F7 to enter copy/scrollback mode
F8 give the window a name, like “top”.
F9 enter in Byobu options.
If you use terminal on your desktop or on your server i’m sure you have understood the potentials of this small software. You can create remote job, detach, ask someone else to reconnect and perhaps later in the day reconnect your self, and this is just a small example.
- In this SteamOS era where do the Linux gaming stand?
- Introduction to gnome maps
- How to manage processes with cgroup on Systemd