Perspective Unspoken

My perspective on Git, Docker, Python, Django, PHP and other stuff

2

A startup script for Byobu

Byobu, is an excellent tool when you have to SSH into a virtual machine that you use regularly for development. Every morning I come in, I do a vagrant up¬†on the project I’m going to be working on for the day. After that I usually have to go about setting up different terminals for my layout. I typically have one terminal for the server log, one for a Python shell, and another for other shell commands I need to run. I always wanted to automate that, and I did. Here’s how… I use Byobu tmux instead of screen btw (use byobu-select-backend to set this).

For starters, we created a detached session using new-session -d. We need a detached session because once Byobu fires up, the subsequent commands won’t be interpreted until Byobu exits. So, detached means we’re still able to send more commands. The rest is pretty straight forward, we create new windows and rename them. The send-keys¬†function is used to send ‘keys’ to the shell window. You can specify the target window with -t index. By default the active window will receive the keys. Finally, there’s a ‘C-m’ at the end of each key stroke since that’s a shortcut for Enter for all the Emacs fans out there.

jaywhy13 • August 17, 2015


Previous Post

Next Post

www.000webhost.com