Screen is a full-screen window manager that multiplexes a physical terminal between several processes, typically interactive shells.
# Using Screen with Livecode
The reason to use screen is so that you can run a long standing command in the background, without the shell() function just hanging and blocking. You can call something like:
screen -dmS fedwiki wiki
First is the d option, in conjunction with the m option. The dm option simply causes your screen to "launch into the background," if you will - steampowered.com
It means your screen will be "detached" instead of showing the screen when you type the command. You can omit this option if you aren't sure if the server will run (like when you're debugging) to show the screen as soon as it starts.
This also means that if Screen itself hasn't been started already, it will be, then the command will be added to a new screen.
Next is the S option. This option is basically a "vanity" option. When you create a new screen, it is automatically assigned a "title" such as "pts-1," "pts-2," etc. This can be confusing. the S option is used to set your own "title" (more on this in a second) to your screen, making things easier to remember.
Next is the title. This is very simply an easy-to-remember name for the screen you are creating. It can be any string of characters, except spaces, with some exceptions, though a good rule is to use words seperated by underscores (_) or dashes/hyphens (-).
Lastly is the command. This should be obvious if you already have your server running. (Screen is, after all, more or less your last step.)
screen -list
This will return something like:
There are screens on: 9999.counter-strike (Detached) 1 Sockets in /tmp/uscreens/S-user.
It will look a little different. 9999 is the numeric identifier. This will generally change each time you make a new screen, and will certainly be different for you than "9999." Then "counter-strike" is the title you assigned to the screen before.
To connect to a given screen, you use the r option.
screen -r identifier
This is how supposed to prevent "session killing". Need to investigate what bash is doing here:
screen -dmS test bash -c 'echo waiting 5 senconds...; sleep 5; exec bash'
# Tutorials
* A quick tutorial on screen - mattcutts.com
* Screen power tips: .screenrc - mattcutts.com
* Taking Command of the Terminal with GNU Screen - linux.com
* Screen users manual - gnu.org
* tecmint.com
* askubuntu.com
* stackexchange.com
YOUTUBE hB6Y72DK8mc
Learn how to use screen in this 2 minute tutorial - rackaid.com
For an easy reference, here's a list of the most common screen commands that you'll want to know. This isn't exhaustive, but it should be enough for most users to get started using screen happily for most use cases.
Start Screen: screen Detatch Screen: Ctrl-a d Re-attach Screen: screen -x or screen -x PID Split Horizontally: Ctrl-a S Split Vertically: Ctrl-a | Move Between Windows: Ctrl-a Tab Name Session: Ctrl-a A Log Session: Ctrl-a H Note Session: Ctrl-a h
Finally, if you want help on GNU Screen, use the man page (man screen) and its built-in help with Ctrl-a :help. Screen has quite a few advanced options that are beyond an introductory tutorial, so be sure to check out the man page when you have the basics down.
# About
Each virtual terminal provides the functions of the DEC VT100 terminal and, in addition, several control functions from the ANSI X3.64 (ISO 6429) and ISO 2022 standards (e.g., insert/delete line and support for multiple character sets) - gnu.org
There is a scrollback history buffer for each virtual terminal and a copy-and-paste mechanism that allows the user to move 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 the current window, view a list of the active windows, turn output logging on and off, copy text between windows, view the scrollback history, switch between windows, 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 users terminal.
# byobu
Looks nice - byobu.co
You can install it on OSX with:
brew install byobu