This week I’ll improve my usage of screen and look up byobu too. Here are some reasons why.
TABS IN THE COMMAND LINE
Modern browsers have used us to the concept of tabs. Interactive web sites are full of tabs. Why not have them also in the shell? With screen and byobu you can.
BETTER SCRIPTING PRODUCTIVITY WITH TABS
You can write your script in one tab and execute it in another after every modification! And in tab 0, for example, you can keep the tail -f of the apache error log when you are developing web applications. You can keep different logs in different tabs and monitor stuff all over the place, even on other machines, as you go on.
MEMORIZE FEW COMMANDS OR CREATE YOUR OWN
There aren’t that many command to learn, and you can also bind your own keystrokes to actions in the screenrc configuration file.
SHELL THAT DOESN’T CHEAT, IT KEEPS WORKING EVEN IF YOU’RE NOT LOOKING
So, the shell continues working for you even if you’re not looking. You can dettach the screen on any remote machine as you leave the office and come back home, reconnect to the machine, and continue working from where you left off. You can leave a tail -f that scrolls files you want to keep track on. Or use watch (-d for colors that indicate changes, -n or –interval for interval).
IF YOUR HAVING CONNECTIVITY PROBLEMS
If you are having connectivity problems, broken pipes, ssh shells freezing on you, you certainly need screen, along with other measures. BTW look up nohup as well 🙂
“Just wanted to mention to other cool tricks you can do with screen. Screen can monitor a window for activity or lack thereof. This is great if you are downloading large files, compiling, or watching for output. If you are downloading something or compiling, you can watch for silence. To start the monitor, go to the screen you want to monitor and use “Ctrl-A” “M” to look for activity or “Ctrl-A” “_” to monitor for silence. Then open or switch to a new window. When the monitor detects activity or silence, you will get an alert at the bottom with the window number. To quickly go to that window, use “Ctrl-A” “ (thats a quote mark, ctrl-a then a “). After you do this, just type in the number of the window and enter. To stop monitoring, go to that window and undo the monitor with the same command. For example, to stop monitoring for activity you would use “Ctrl-A” “M” again.”
INVITE USERS INTO A SCREEN SESSION
An interesting teaching tool if you want to show someone how something is done in the command line. I still have to try that!
SCROLLING AND SEARCHING
You can’t do the usual shift and page up to scroll like in a normal shell, when in screen. But you can
CUSTOMIZE SCREEN WITH SCREENRC
“A typical application of this tidbit of knowledge is to launch a predefined set of windows at screen startup. Below is a sample screenrc that will do so:# read in your normal screenrc # before anything else source $HOME/.screenrc # now start opening windows screen top # it's possible to set the window title with # the -t option screen -t irc epic # you can also specify the window number # to launch in screen -t mail 8 mutt screen -t daemon 9 tail -f /var/log/daemon.log
If you save this to $HOME/.screenrc.multiwin you can tell screen to use it instead of your normal .screenrc by running screen -c $HOME/.screenrc.multiwin”
I’ll write a separate post on that some day 🙂