Byobu

Ubuntu Open Week - Byobu - DustinKirkland- Tue, Nov 3, 2009

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. Come learn about Byobu in Ubuntu!

(01:00:46 PM) kirkland: Alrighty, I'll attempt to follow the illustrious Jono's presentation on the Bacon Community
(01:00:54 PM) jono: lol
(01:01:02 PM) kirkland: ask him about his very own t-shirt line on the subject some time :-)
(01:01:06 PM) jono: haha
(01:01:07 PM) kirkland: okay, howdy everyone
(01:01:12 PM) jono: rock on kirkland :-)
(01:01:26 PM) kirkland: my presentation is on an awesome piece of software that I think makes Ubuntu very unique
(01:01:33 PM) kirkland: particularly, Ubuntu servers and command lines
(01:01:38 PM) kirkland: but Ubuntu desktops too
(01:01:44 PM) kirkland: something I wrote called Byobu
(01:01:57 PM) kirkland: question 1 is usually, "how on earth do you pronounce that..."
(01:02:08 PM) kirkland:  * http://people.canonical.com/~kirkland/byobu.wav
(01:02:16 PM) kirkland: well there you go
(01:02:26 PM) kirkland: byobu is a japanese term for a fancy, folding screen
(01:02:38 PM) kirkland: http://images.google.com/images?q=byobu  <--- something like that
(01:02:58 PM) kirkland: so a quick poll over in #ubuntu-classroom-chat ....
(01:03:16 PM) mode (+o fetova ) by ChanServ
(01:03:17 PM) mode (-o fetova ) by ChanServ
(01:03:37 PM) kirkland: raise your right hand o/ if you're completely new to GNU screen in #ubuntu-classroom-chat
(01:04:11 PM) kirkland: okay, so byobu is a layer of scripts and configuration utilities that sit on top of GNU screen
(01:04:19 PM) kirkland: i think that it makes it far more useful, and usable
(01:04:32 PM) kirkland: in jaunty, an early version of byobu was available under a different name
(01:04:37 PM) kirkland: called, screen-profiles
(01:04:51 PM) kirkland: byobu is the followon to screen-profiles, being much faster and more usable
(01:04:58 PM) kirkland: so lets dive right into the demonstration!
(01:05:15 PM) kirkland: to participate in the demo, you will need to keep an eye on your irc client (here)
(01:05:34 PM) kirkland: and to open up a new terminal, like gnome-terminal, and ssh to a system i've configured in EC2
(01:05:58 PM) kirkland: ssh -C guest@ec2-75-101-202-231.compute-1.amazonaws.com
(01:06:01 PM) kirkland: the password is guest
(01:06:16 PM) kirkland: you will have read-only access to this screen
(01:06:19 PM) kirkland: and i'll drive the demo
(01:06:37 PM) kirkland: at the moment, you should see something that looks like the Matrix on the screen
(01:07:10 PM) kirkland: i generated this setup with another tool i wrote called "screenbin"
(01:07:17 PM) kirkland: for sharing screensessions in EC2
(01:07:22 PM) kirkland: okay, we have 30+ people in already
(01:07:27 PM) kirkland: so i'm going to unlock the screen
(01:07:57 PM) kirkland: now, i've ssh'd to a second machine in EC2
(01:08:02 PM) kirkland: where I'm running byobu!
(01:08:07 PM) kirkland: byobu is a window manager
(01:08:17 PM) kirkland: similar, in some respects to gnome or kde
(01:08:24 PM) kirkland: but entirely in a text interface
(01:08:36 PM) kirkland: we can open new windows, move among open windows
(01:08:39 PM) kirkland: attach/detach from sessions
(01:08:53 PM) kirkland: and configure notification applets
(01:09:05 PM) kirkland: okay, so across the bottom of the screen you should see 2 lines
(01:09:18 PM) kirkland: the upper line showing the open windows
(01:09:25 PM) kirkland: the lower line showing some stats about my system
(01:09:34 PM) kirkland: most of the keybindings are attached to F-keys
(01:09:40 PM) kirkland: so first, i'm going to open a few more windows
(01:09:45 PM) kirkland: using the <F2> key
(01:09:54 PM) kirkland: now i have windows 0 - 3
(01:10:08 PM) kirkland: i can use <F3> and <F4> to move back and forth among the windows
(01:10:25 PM) kirkland: let's run a few different programs in each window
(01:10:30 PM) kirkland: i'm going to run "top" in window 3
(01:10:50 PM) kirkland: now, i want to rename window 3 from "bash" to "top"
(01:10:58 PM) kirkland: so I use the <F8> key
(01:11:09 PM) kirkland: i'll choose a name for this window to make it easier to find
(01:11:33 PM) kirkland: now i can move back and forth to the "top" window when I need to
(01:11:57 PM) kirkland: perhaps i use other windows for a web browser, and irc
(01:12:24 PM) kirkland: you get the idea
(01:12:40 PM) kirkland: now, let's play with the configuration
(01:12:50 PM) kirkland: you should see a hint on one of the lines at the bottom
(01:12:57 PM) kirkland: Menu:<F9>
(01:13:18 PM) kirkland: here, we have a curses based menu
(01:13:26 PM) kirkland: first, let's look at the help available on Byobu
(01:13:40 PM) kirkland: this shows you these F-keybindings that i've been using
(01:13:50 PM) kirkland: we've gone over F2, F3, F4, F8, and F9
(01:13:55 PM) kirkland: we'll do the other shortly
(01:14:18 PM) kirkland: now consider for a second the normal screen keybidings
(01:14:21 PM) kirkland: ie, without Byobu
(01:15:15 PM) kirkland: hmm, i'm having trouble getting those to come up because of my double screen session
(01:15:29 PM) kirkland: but if you try ctrl-a-? in a local screen session, you'll see them
(01:15:46 PM) kirkland: let's look at the other config options
(01:15:54 PM) kirkland: we can change the colors of the two lines across the bottom
(01:16:20 PM) kirkland: okay, i've changed it to cyan
(01:16:25 PM) kirkland: there's ~15 different colors
(01:16:33 PM) kirkland: i like to use a different color on each server i manage
(01:16:42 PM) kirkland: helps with visual recognition of what machine i'm on
(01:17:05 PM) kirkland: i can also toggle the status notifications of the little things across the bottom
(01:17:18 PM) kirkland: these are "status notifications"
(01:17:26 PM) kirkland: so i can see what i have enabled/disabled right now
(01:17:45 PM) kirkland: now for compatibility, i opened this session 80x25, so that it should fit on *everyone's* screen
(01:18:02 PM) kirkland: but normall i run my terminals *much* bigger than that, so that i can fit more info across the bottom
(01:18:20 PM) kirkland: i'm going to enable a couple more here
(01:19:06 PM) kirkland: okay, i'm going to turn on: hostname, whoami, ipaddress and network traffic
(01:19:26 PM) kirkland: okay, no i've overused my 80 characters across, so let's turn a few more off
(01:19:39 PM) kirkland: first, that red "4!" tells me that there are 4 updates available for my system
(01:19:42 PM) kirkland: let's install those
(01:20:03 PM) kirkland: give it 7 seconds
(01:20:10 PM) kirkland: and that 4! should disappear ....
(01:20:37 PM) kirkland: boom
(01:20:40 PM) kirkland: the updates installed
(01:20:48 PM) kirkland: also, i don't really need to know my uptime here
(01:20:51 PM) kirkland: let's turn that off
(01:21:19 PM) kirkland: and this is EC2, so i don't really care about my cpu speed
(01:21:28 PM) kirkland: on my laptop i do, because i use frequency scaling
(01:21:32 PM) kirkland: Amazon does not though
(01:21:41 PM) kirkland: cool
(01:21:52 PM) kirkland: now my info fits across the bottom line
(01:22:06 PM) kirkland: i'm actually going to turn off the hostname too, since the ip address and hostname are very similar
(01:22:25 PM) kirkland: and now that i know that F9 is the menu, i don't need that either
(01:22:36 PM) kirkland: clear?
(01:22:38 PM) kirkland: cool
(01:22:49 PM) kirkland: so across the bottom, we have a "logo"
(01:22:59 PM) kirkland: the 3 color \o/ is like 1/3 of the ubuntu logo
(01:23:05 PM) kirkland: this is an Ubuntu 9.10 system
(01:23:11 PM) kirkland: which differs based on where you run this
(01:23:29 PM) kirkland: 1# means that there's only 1 person logged into *this* system
(01:23:44 PM) kirkland: actually all of you (42 of you) are logged into a different one, that i used to ssh to this one
(01:23:53 PM) kirkland: the ~$0.31 is interesting here....
(01:24:03 PM) kirkland: that's an approximation of how much this EC2 instance is costing me
(01:24:08 PM) kirkland: (or Canonical, as the case is)
(01:24:15 PM) kirkland: there's up and down networking
(01:24:21 PM) kirkland: which is pretty low right now
(01:24:30 PM) kirkland: but if I start downloading something big, that will spike
(01:25:11 PM) kirkland: let's watch the network traffic increase :-)
(01:25:26 PM) kirkland: that's a lot of bandwidth :-)
(01:25:40 PM) kirkland: i can go back and forth to other windows
(01:25:42 PM) kirkland: while that downloads
(01:25:52 PM) kirkland: in fact, I can disconnect, and come back later!
(01:25:55 PM) kirkland: watch this ...
(01:25:58 PM) kirkland: F6 -> detach
(01:26:08 PM) kirkland: so now I'm back at my other system
(01:26:41 PM) kirkland: sorry, forgot how to reattach for a second there !
(01:26:41 PM) kirkland: byobu -x reattaches
(01:26:55 PM) kirkland: as you can see, my download continued in the background
(01:27:24 PM) kirkland: let's look at the rest of the configuration
(01:27:32 PM) kirkland: so perhaps you don't like the F-keys
(01:27:38 PM) kirkland: because they conflict with some other program
(01:27:39 PM) kirkland: like mc
(01:27:50 PM) kirkland: you can disable them easily here
(01:28:07 PM) kirkland: or you can just toggle them on/off while you're in byobu with ctrl-a-!
(01:28:19 PM) kirkland: but i like them, so i'm going to cancel
(01:28:32 PM) kirkland: i can also change the escape sequence
(01:28:36 PM) kirkland: which is ctrl-a by default
(01:28:42 PM) kirkland: but often emacs users dislike this
(01:28:54 PM) kirkland: actually, since i'm using 2 screen session here, ctrl-a is problematic for me
(01:29:00 PM) kirkland: i'm going to switch this one to ctrl-b
(01:29:20 PM) kirkland: hah!
(01:29:28 PM) kirkland: now i can show you screen's hot keys
(01:29:33 PM) kirkland: i used ctrl-b-?
(01:29:37 PM) kirkland: this is screen's help
(01:30:02 PM) kirkland: to do something like our F3/F4 to go back and forth between windows you use ctrl-a-p and ctrl-a-n
(01:30:07 PM) kirkland: i think F3/F4 is easier :-)
(01:30:27 PM) kirkland: you can also have a set of default windows open for you when you use byobu
(01:30:35 PM) kirkland: you can use these or create your own
(01:30:42 PM) kirkland: none are enabled by default
(01:31:01 PM) kirkland: but similar to opening firefox and launching your favorite 10 webpages in tabs, you can do something similar in byobu
(01:31:17 PM) kirkland: finally, you can toggle this setting on and off
(01:31:32 PM) kirkland: i like byobu so much i have it launch by default every time I ssh or login to a system
(01:31:43 PM) kirkland: this is nice because my commands are *always* running in a screen session
(01:31:50 PM) kirkland: I can easily attach/detach any time
(01:32:02 PM) kirkland: perhaps my Xorg crashes, or my wifi drops
(01:32:11 PM) kirkland: my programs continue to run in screen
(01:32:14 PM) kirkland: and I just reattach later
(01:32:38 PM) kirkland: so back to the notifications ....
(01:32:52 PM) kirkland: let's say you wanted to find out more about one of the brief little icons at the bottom
(01:33:04 PM) kirkland: there's a special key you can hit to get detailed information
(01:33:08 PM) kirkland: ctrl-a-$
(01:33:32 PM) kirkland: this is a fancy mode of vim
(01:33:37 PM) kirkland: there are a couple of hints at the top
(01:33:41 PM) kirkland: special keys
(01:33:47 PM) kirkland: zr, zo, zm, zc
(01:34:26 PM) kirkland: for instance, here's a breakdown of my ec2 cost by component
(01:35:01 PM) kirkland: cool?
(01:35:06 PM) kirkland: okay ...
(01:35:23 PM) kirkland: let's take a quick tour of the config directory
(01:35:39 PM) kirkland: so your configuration is in .byobu
(01:35:54 PM) kirkland: your "profile" is a symlink to one of the colored profiles
(01:36:10 PM) kirkland: changing your color is a matter of updating this symlink (which you can do in the menu)
(01:36:30 PM) kirkland: this is the nastiness that byobu handles for you :-)
(01:36:42 PM) kirkland: screen is really powerful, but can be painful to configure
(01:37:05 PM) kirkland: so one last feature before we open it up for questions ....
(01:37:21 PM) kirkland: perhaps you use some other distro that doesn't have byobu
(01:37:43 PM) kirkland: or perhaps you have access to an Ubuntu machine that doesn't have byobu, and you don't have admin access to install it
(01:37:50 PM) kirkland: byobu comes with an "export" utility
(01:38:05 PM) kirkland: that will "flatten" the configuration, such that you can copy it somewhere else
(01:38:20 PM) kirkland: ultimately, byobu is just a really complex screenrc configuration
(01:38:25 PM) kirkland: man byobu-export
(01:38:43 PM) kirkland: this is the ticket!
(01:38:53 PM) kirkland: so i'll choose a color
(01:39:13 PM) kirkland: and it creates a .tar.gz tarball that i can copy and unzip elsewere
(01:39:27 PM) kirkland: i'll unzip it to show you what's in there
(01:39:43 PM) kirkland: so now i have a .screenrc
(01:40:00 PM) kirkland: this is just one giant, monolithic byobu configuration
(01:40:18 PM) kirkland: note that the one we use in our package is more modular, and how we can turn features on/off dynamically
(01:40:26 PM) kirkland: you'll loose a little of that with the export
(01:40:38 PM) kirkland: but still, it's pretty cool to be able to install this anywhere that you have gnu screen
(01:40:52 PM) kirkland: i actually use byobu on my Palm Pre, which has WebOS, and includes screen!
(01:40:56 PM) kirkland: it works like a champ!
(01:41:09 PM) kirkland: and then there are a few helper scripts in there too
(01:41:34 PM) kirkland: okay, so i'm going to open the floor to questions.... please post your questions in #ubuntu-classroom-chat, and lead with kirkland: Q:
(01:42:57 PM) kirkland: nperry-work: sure ... Applications -> Accessories -> Terminal
(01:43:01 PM) kirkland: nperry-work: and type "byobu"
(01:43:08 PM) kirkland: nperry-work: that should start a new session
(01:43:29 PM) kirkland: actually, I encourage *everyone* to give that a shot now, since none of you had write access to our shared term
(01:43:38 PM) kirkland: MenZa: thanks for the kind words :-)
(01:44:26 PM) kirkland: brettalton: as to color selection being ambiguous, please file a bug with a suggestion for the improved verbage
(01:45:01 PM) kirkland: brettalton: defaulting to your local chosen colors would be a sane thing to do, probably
(01:45:47 PM) kirkland: nperry-work: i don't know what thunar is, but if it's text-based,yes, you should be able to
(01:46:13 PM) kirkland: but only text-based programs will run in here
(01:46:25 PM) kirkland: you can launch X programs, if you're using SSH x-forwarding
(01:47:04 PM) kirkland: lbrinkma: oh, good question about ctrl-a-$ on german keyboard ... I don't know honestly; open a bug about that
(01:48:01 PM) kirkland: MenZa: regarding your busted colors ....
(01:48:22 PM) kirkland: MenZa: i see you're on Ubuntu 8.10, which has a bug in screen itself (fixed in later versions, and in the byobu-ppa)
(01:48:35 PM) kirkland: MenZa: it arbitrarily limits color changes on that line to something very small
(01:48:46 PM) kirkland: MenZa: upgrade to the backported screen version in the byobu ppa
(01:49:35 PM) kirkland: brettalton: right so it was really hard for me to choose keybindings
(01:49:42 PM) kirkland: brettalton: you can always just run "byobu-config" by hand
(01:49:59 PM) kirkland: brettalton: also, if you have a look at the keybindings definitions, you could add your own to your local ~/.screenrc
(01:50:25 PM) kirkland: brettalton: your local ~/.screenrc is source LAST, so you can override most of byobu's defaults there, if you're comfortable writing a liine or two of screen config code
(01:51:09 PM) kirkland: alyssum: so F6 is how you detach
(01:51:17 PM) kirkland: alyssum: and "byobu -x" is how you re-attach
(01:51:29 PM) kirkland: alyssum: i setup all of my servers to launch byobu by default
(01:51:39 PM) kirkland: alyssum: and i use F6 to detach, if i need
(01:52:03 PM) kirkland: cyphermox: good question ... that's a limitation of screen itself
(01:52:11 PM) kirkland: cyphermox: something that i'd like to fix in the screen source code
(01:52:33 PM) kirkland: cyphermox: basically, you could have it automatically update "something" to the last command run in that window
(01:52:40 PM) kirkland: cyphermox: that's the closest we could get
(01:52:50 PM) kirkland: cyphermox: i played with it a little, but i didn't like it
(01:53:01 PM) kirkland: cyphermox: if i ran "ls", my window would change its name to "ls"
(01:53:11 PM) kirkland: cyphermox: so it was changing "a lot" ... wasn't quite right yet
(01:53:25 PM) kirkland: cyphermox: so for now, the F8 thing is necessary; sorry
(01:54:08 PM) kirkland: brettalton: so to have byobu launch by default ....
(01:54:20 PM) kirkland: brettalton: first, go to each system and sudo apt-get install byobu (if it's not there already)
(01:54:29 PM) kirkland: brettalton: launch a byobu session with "byobu"
(01:54:35 PM) kirkland: brettalton: go to configuration -> F9
(01:54:52 PM) kirkland: brettalton: and toggle the bottom item     │     Byobu currently launches at login (toggle off)                   │
(01:55:16 PM) kirkland: brettalton: then each time you login (ssh or tty), you will start a new byobu session, or reattach to an existing one
(01:55:44 PM) kirkland: sebsebseb: so shared write access ....
(01:55:54 PM) kirkland: sebsebseb: that's something a little different, separate from byobu
(01:56:03 PM) kirkland: sebsebseb: basically, there's two things I needed to do ....
(01:56:13 PM) kirkland: sebsebseb: I needed to make /usr/bin/screen setuid to root
(01:56:24 PM) kirkland: -rwsr-sr-x 1 root utmp 361080 2009-07-06 05:36 /usr/bin/screen*
(01:56:34 PM) kirkland: and then i needed to add a few lines to my .screenrc
(01:56:46 PM) kirkland: ubuntu@ip-10-243-18-53:~$ cat .screenrc
(01:56:46 PM) kirkland: aclumask guest+r guest-w guest-x
(01:56:46 PM) kirkland: aclchg guest +r-w-x '#?'
(01:56:46 PM) kirkland: aclchg guest +x 'prev,next,select,detach'
(01:56:48 PM) kirkland: multiuser on
(01:57:02 PM) kirkland: these aren't default in Ubuntu for obvious security reasons
(01:57:06 PM) kirkland: for the sake of EC2 and this demo, I don't care
(01:57:17 PM) kirkland: if one of you starts misbehaving, I just pull the plug on the VM and it's gone :-)
(01:57:36 PM) kirkland: Landon: great question about screen-profiles vs. byobu !
(01:57:59 PM) kirkland: Landon: a complete list of improvements is available at http://blog.dustinkirkland.com/2009/11/ubuntu-910-byobu-and-openweek-session.html
(01:58:05 PM) kirkland: Landon: the highlights ...
(01:58:17 PM) kirkland: Landon: it's *much* faster, more responsive, performant
(01:58:24 PM) kirkland: Landon: and it has a lot of little usability improvements
(01:58:46 PM) kirkland: okay ,my time is running out
(01:58:51 PM) kirkland: let me leave you with a couple of links ....
(01:58:59 PM) kirkland: if you want to talk more, head over to #byobu
(01:59:19 PM) kirkland: if you want to follow announcements, tutorials, howtos, etc, subscribe to: http://blog.dustinkirkland.com/search/label/Byobu
(01:59:34 PM) kirkland: and for code, dev info, bugs, etc.: https://edge.launchpad.net/byobu
(01:59:40 PM) kirkland: thanks so much for your time
(01:59:57 PM) kirkland: if i didn't get to your question, please post in #byobu and i'll answer them there
(01:59:58 PM) mode (+o akgraner ) by ChanServ
(02:00:06 PM) kirkland: done!

MeetingLogs/openweekKarmic/Byobu (last edited 2009-11-03 19:31:28 by pool-71-182-105-84)