== Open Week -- Byobu -- Dustin Kirkland -- Mon, May 3 == EDT -5 {{{ (01:59:16 PM) ***kirkland fires up an ec2 instance (01:59:56 PM) kirkland: alrighty everyone ... fire up your terminals! (02:01:19 PM) kirkland: ssh -C guest@ec2-184-73-5-80.compute-1.amazonaws.com (02:01:26 PM) kirkland: everyone: please run that command (02:01:30 PM) kirkland: the password is "guest" (02:01:51 PM) kirkland: please expand your terminal to at least 112x30 (02:02:03 PM) kirkland: (which is a little bigger than the default 80x24) (02:02:20 PM) kirkland: a few people pouring in .... (02:02:36 PM) kirkland: alright, let's start! (02:02:47 PM) kirkland: so you are currently SSH'd into EC2 (02:02:55 PM) kirkland: this is an instance running 10.04 LTS in EC2 (02:03:11 PM) kirkland: and you're watching the "cmatrix" program (02:03:19 PM) kirkland: but this is about byobu! (02:03:33 PM) kirkland: byobu is a fancy set of configuration wrapped around GNU screen (02:03:44 PM) kirkland: screen is a text based "window manager" (02:03:48 PM) kirkland: really, really powerful (02:03:51 PM) kirkland: but really complex (02:04:06 PM) kirkland: byobu is basically "screen for human beings" :-) (02:04:13 PM) kirkland: alright, let's dive in (02:04:24 PM) kirkland: try to watch your irc channel and the ssh session you have into ec2 (02:04:40 PM) ClassBot: mhall119 asked: 23:b4:5a:d4:83:be:a2:ca:b0:67:86:ef:1a:eb:f3:b7 is the host key's fingerprint? (02:04:40 PM) kirkland: now, I have read/write permission in this session (02:04:51 PM) kirkland: mhall119: :-) thanks for asking, yes! (02:05:26 PM) kirkland: everyone else just has read permission (02:05:39 PM) kirkland: you can start your own byobu session in your own terminal on your own system right now too (02:05:46 PM) kirkland: if you want to play along there as well (02:05:55 PM) kirkland: so for starters, let's go to the menu (02:06:14 PM) kirkland: you should see two "tabs" pop up at the bottom of the screen (02:06:17 PM) kirkland: 0-&$ shell 1*&$ config ubuntu@ip-10-194-73-155 10.194.73.155 Menu: (02:06:31 PM) kirkland: currently, the 0 window is highlighted (02:06:42 PM) kirkland: use F3/F4 to move back and forth between these two windows (02:06:49 PM) kirkland: the "1" window is the configuration menu (02:07:04 PM) kirkland: as i said, in this session, i have read/write access, and you're all sharing read access (02:07:25 PM) kirkland: let's start with the Help part of the menu for a quick intro (02:07:37 PM) kirkland: the most common screen commands have been mapped to F-keys in Byobu (02:07:46 PM) kirkland: most importantly, F2 creates new windows (02:07:49 PM) kirkland: i'm going to do that now (02:08:04 PM) kirkland: so now I have shells 0 - 4 running (02:08:17 PM) kirkland: use F3 and F4 to move backward and forward between the windows (02:08:38 PM) ClassBot: mhall119 asked: what flags did you use to create this shared session? (02:08:52 PM) kirkland: mhall119: i used a program called "screenbin" to create this session (02:08:58 PM) kirkland: mhall119: install that, and see /usr/bin/screenbin (02:09:13 PM) kirkland: F5 will refresh the screen (02:09:28 PM) kirkland: which mainly instantly updates all the of the little status indicators at the bottom (02:09:37 PM) kirkland: F6 detaches from the session (02:09:46 PM) kirkland: which is *really* useful if you want to run a bunch of programs on your sever (02:09:56 PM) kirkland: like a long wget or compile or something (02:10:04 PM) kirkland: drive home, and then reconnect later (02:10:14 PM) kirkland: F7 enters scrollback mode (02:10:40 PM) kirkland: which is nice to scroll way back in logs (02:10:52 PM) kirkland: F8 renames a window (02:11:09 PM) kirkland: i just renamed window 2 to "dmesg" (02:11:15 PM) kirkland: so F3/F4 over to window2 (02:11:33 PM) kirkland: and you can see me scrolling around my dmesg output (02:12:00 PM) kirkland: it's sort of vi-like in its navigation (02:12:07 PM) kirkland: F8 is useful to organize your windows (02:12:33 PM) kirkland: i just renamed window 0 to "top" and started top running there (02:12:41 PM) kirkland: F9 launches this menu (02:13:06 PM) kirkland: and F12 locks the screen, which is useful if you're walking away from a terminal and you want to lock the screen, while your programs are still running (02:13:24 PM) kirkland: besides these, there are dozens of other commands that screen accepts (02:13:31 PM) kirkland: see the screen(1) and the byobu(1) manpages (02:13:33 PM) ClassBot: dieresys asked: the characters right to the windows number are constantly changing. What's that? (02:14:01 PM) kirkland: good question (02:14:20 PM) kirkland: dieresys: the * identifies the "current" window (which is also identified by the inverted color) (02:14:46 PM) ClassBot: cyberanger asked: what is the 37# icon at the bottom (02:14:50 PM) kirkland: the @ means that the window has been "updated" somehow (02:15:08 PM) kirkland: cyberanger: the 37# is how many users are logged into this session right now ;-) (02:15:17 PM) kirkland: so let's look at the bottom information (02:15:23 PM) ClassBot: TMKCodes asked: Does CTRL+A+D detach too? i'm way used to it with screen (02:15:34 PM) kirkland: go to the window 1, configuration (02:15:47 PM) kirkland: and let's look at "Toggle status notifications" (02:16:17 PM) kirkland: TMKCodes: all screen escapes are perfectly passed through to screen, and work just fine (02:16:30 PM) kirkland: here we have a ton of "widgets" we can add to our session (02:16:37 PM) kirkland: you can see what's currently turned on (02:16:45 PM) kirkland: let's turn on a few fun ones (02:16:46 PM) ClassBot: cyberanger asked: how secure is the lock (02:16:52 PM) kirkland: battery doesn't make much sense here (02:17:07 PM) kirkland: nor does cpu temp (this is a virtual machine!) (02:17:15 PM) kirkland: but "ec2_cost" does! (02:17:25 PM) kirkland: that's how much I'm paying right now to share this session with all of you (02:17:29 PM) kirkland: so i just toggled that one on (02:17:35 PM) kirkland: and i'm going to click Apply (02:17:47 PM) kirkland: i see a little icon show up (02:17:58 PM) kirkland: so I press F5 and refresh my profile (02:18:14 PM) kirkland: and I see that this EC2 instance is costing me ~$0.39 (02:18:15 PM) kirkland: :-) (02:18:32 PM) kirkland: let's turn on some more (02:18:57 PM) kirkland: there, i've turned on a bunch, and i'll explain them from left to right (02:19:10 PM) kirkland: on the far left is our distro logo, name, and version (02:19:30 PM) kirkland: if there were any updates available for this system, I would see a white number on a red background (02:19:34 PM) kirkland: with an ! (02:19:40 PM) kirkland: (but I don't have any updates available) (02:19:52 PM) kirkland: 36# = 36 concurrent users (02:20:00 PM) kirkland: 20m = uptime of 20 minutes (02:20:30 PM) kirkland: ^13kB/s v4kB/s = the average network traffic up and down over the last 3 seconds (02:20:35 PM) kirkland: 0.04 = the system load (02:20:46 PM) kirkland: 2x2.7GHz = 2 CPUs, at 2.7GHz (02:20:57 PM) kirkland: 7.5GB,5% = total memory, and the percent in use (02:21:09 PM) kirkland: 15GB,6% = total disk space, and the percent used (02:21:20 PM) kirkland: 18:21 UTC = the current time in UTC (02:21:24 PM) kirkland: and then the date/time (02:21:37 PM) kirkland: above and to the right, we see a hint for the F9 -> Menu (02:21:43 PM) kirkland: the external ip address (02:21:47 PM) kirkland: and the username@hostname (02:22:04 PM) kirkland: there are some more interesting notifications that might be more appropriate for your laptop (02:22:13 PM) kirkland: like your battery, temperature, wifi, etc. (02:22:37 PM) ClassBot: NielsE asked: how do I close a window? (02:22:40 PM) kirkland: now, if you use byobu on a bunch of different servers it might be helpful to color code them (02:22:57 PM) kirkland: NielsE: either "exit" from the shell, or press ctrl-a-k (02:23:16 PM) kirkland: NielsE: to close all windows, use ctrl-a-\ (02:23:26 PM) kirkland: btw, ctrl-a is the "escape" sequence (02:23:38 PM) kirkland: it's how you escape from your shell, and give screen itself a command (02:23:51 PM) kirkland: many of these are hard to remember or press in some cases (02:24:04 PM) kirkland: which is why Byobu maps the most frequently used ones to easy-to-find F-keys (02:24:29 PM) kirkland: so now i've changed the colors of the panel at the bottom (02:24:38 PM) kirkland: perhaps you're running Radiance instead of Ambiance (02:24:50 PM) kirkland: this might look a bit better, dark text on a light background (02:25:04 PM) kirkland: actually, there's a lot of different color combinations you can use (02:25:36 PM) kirkland: so i just mentioned that "ctrl-a" is the "escape sequence" (02:25:42 PM) kirkland: that's traditionally screen's default (02:25:49 PM) kirkland: you can change this very easily, if you like (02:26:01 PM) kirkland: as emacs users often fight with screen taking over ctrl-a (02:26:18 PM) kirkland: (actually, emacs users could just use ctrl-a-a to get the same functionality, but meh) (02:26:30 PM) kirkland: you can change your escape sequence in the F9 menu very easily (02:26:42 PM) kirkland: finally, let's look at the last option at the bottom (02:26:46 PM) kirkland: │ Byobu currently launches at login (toggle off) │ (02:26:59 PM) kirkland: this is really, really, really useful, in my not-so-humble-opinion ;-) (02:27:16 PM) kirkland: i *always* setup all of my ubuntu desktops and servers to launch byobu by default at login (02:27:37 PM) kirkland: this means that every time I log into a system on the console or via ssh, i'm in a byobu session (02:27:52 PM) kirkland: and i can create multiple windows/shells, and navigate between them easily (02:28:06 PM) kirkland: this sure beats having 5 separate ssh session to get 5 shells on my server (02:28:16 PM) kirkland: also, it gives me the ability to attach and detach (02:28:28 PM) kirkland: in your local terminal (where you have read write access), try this .... (02:28:41 PM) kirkland: Applications -> Accessories -> Terminal (02:28:44 PM) kirkland: enter "byobu" (02:28:49 PM) kirkland: press F2 a few times (02:28:55 PM) kirkland: maybe run "top" in one window (02:29:07 PM) kirkland: perhaps "w3m http://google.com" in another (02:29:13 PM) kirkland: and then press F6 to detach (02:29:16 PM) kirkland: close your terminal (02:29:19 PM) kirkland: open another terminal (02:29:22 PM) kirkland: and type "byobu" (02:29:38 PM) kirkland: you should get launched back into the same session, with your programs still running (02:29:56 PM) kirkland: so this is really useful (02:30:01 PM) ClassBot: cyberanger asked: how secure is the lock on byobu, would it really simple to bypass & thus is better for deterrence or is it relible to actually keep someone out? (02:30:44 PM) kirkland: cyberanger: hmm, probably deterrence, but I have not audited that bit of screen's code (02:31:32 PM) kirkland: alrighty questions? (02:31:38 PM) kirkland: before we move onto the hard stuff :-) (02:32:05 PM) akgraner: There's no questions right now that I can see (02:32:11 PM) kirkland: alright, so eyes back to the ec2 session (02:32:22 PM) kirkland: let's explore where byobu puts stuff, and how to get at the power features :-) (02:32:35 PM) kirkland: once you've run byobu once, you have a ".byobu" directory (02:32:41 PM) kirkland: in here, we have a few things (02:32:42 PM) kirkland: files (02:32:45 PM) kirkland: that byobu sources (02:33:01 PM) kirkland: the "color" file describes the foreground and background colors (02:33:33 PM) kirkland: and the monochrome bit can make it look really nice with the new icons in the top right of the Ubuntu 10.04 desktop (02:33:43 PM) kirkland: i'm going to enable that, and then hit F5 (02:34:02 PM) kirkland: slick? (02:34:17 PM) kirkland: but i like color :-) (02:34:35 PM) kirkland: so ec2_rates is just the rates that EC2 charges (02:35:12 PM) kirkland: that file is there such that you can modify them, in case Amazon changes their rates before I can roll an update out for byobu (02:35:27 PM) kirkland: you can add your own custom keybindings in the keybindings file (02:35:47 PM) kirkland: some people like to change or add their own (02:36:09 PM) kirkland: the "status" file is how you'd manually turn status scripts on and off (02:36:21 PM) kirkland: also, some status scripts take tunable parameters (02:36:25 PM) Andre_Gondim is now known as Andre_Gondim-afk (02:36:34 PM) kirkland: for instance, the "disk" one monitors the / filesystem by default (02:36:41 PM) kirkland: but you could change this to say /home or whatever (02:36:51 PM) kirkland: the byobu manpage is your friend (02:36:54 PM) kirkland: it tells you all about these (02:37:27 PM) kirkland: there's one example on the screen, MONITORED_DISK=/wherever in $HOME/.byobu/statusrc (02:38:03 PM) kirkland: the windows file is interesting, in that you have have byobu launch with a bunch of windows opened for you, running programs you want, at launch time (02:38:11 PM) kirkland: and then there's the biggie ... (02:38:14 PM) kirkland: profile (02:38:24 PM) kirkland: by default, profile -> /usr/share/byobu/profiles/common (02:38:30 PM) kirkland: that's the one that we "ship" (02:38:40 PM) kirkland: you could copy that here, and edit it, if you like (02:38:46 PM) kirkland: hold your breath .... (02:39:14 PM) kirkland: so this is the source code for the actual "profile" (02:39:29 PM) kirkland: this is what you'd have to write for yourself, from scratch, if you wanted to do all of this in screen by itself (02:39:42 PM) kirkland: hardstatus string '%99`%{-}%{=r}%12` %100`%112`%= %130`%102`%101`%129`%131`%127`%114`%115`%108`%128`%125`%126`%113`%119`%117`%116`%106`%104`%103`%105`%107`%123`%132`%120`%121`' (02:39:50 PM) kirkland: that, for instance, is your bottom status line :-) (02:40:09 PM) kirkland: and hopefully now you see "why" I think that byobu is screen for human beings :-) (02:40:27 PM) kirkland: oh, and one really cool new feature for the 10.04 byobu (02:40:32 PM) kirkland: "custom" status scripts! (02:40:40 PM) kirkland: you can write your own status notification *trivially* (02:40:51 PM) kirkland: first, let me disable a few to make some room (02:41:21 PM) kirkland: alright, i got rid of disk and network (02:42:10 PM) kirkland: so let's add a notification that states the kernel version (02:42:14 PM) kirkland: we can get that with uname -r (02:42:25 PM) kirkland: so let's mkdir bin in .byobu (02:42:30 PM) kirkland: go into bin (02:42:49 PM) kirkland: and let's create a file called 10000_kernel (02:43:09 PM) kirkland: the "10000" states how often in seconds the script needs to run (02:43:25 PM) kirkland: clearly, we don't need to run this often, as your kernel version doesn't change (unless you reboot) :-P (02:43:33 PM) kirkland: and the _kernel just names the script (02:43:43 PM) kirkland: in that script, i just added some simple shell code (02:43:49 PM) kirkland: that calls uname -r (02:44:13 PM) ClassBot: TMKCodes asked: if i use byobu does it cost? as i tried it and it showed ~$2.30 ec2_cost (02:44:17 PM) kirkland: this script can be in whatever language you want, as long as it's executable, and writes to standard out (02:44:34 PM) kirkland: notice that it's not showing up yet (02:44:43 PM) kirkland: because the script is not executable (02:44:52 PM) kirkland: this is a simple way to enable/disable your custom scripts (02:45:01 PM) kirkland: so let's make it executable (02:45:05 PM) kirkland: and now F5 (02:45:13 PM) kirkland: 2.6.32-305-ec2 --- woohoo :-) (02:45:27 PM) kirkland: now, go crazy writing your scripts to monitor whatever it is you care about (02:45:57 PM) kirkland: TMKCodes: byobu tries to use the algorithm Amazon uses to estimate cost (02:46:25 PM) kirkland: TMKCodes: basically, it's a function of your a) uptime, b) processors, c) memory, d) disk utilization, e) network utilization (02:46:50 PM) kirkland: TMKCodes: as such, if you run it on a sever in EC2, it'll show you pretty close to what that instance costs you (02:47:19 PM) kirkland: TMKCodes: if you run it somewhere else (like your laptop, or your own server), it will show you what that machine (since boot) would have costed you in EC2 (02:47:34 PM) kirkland: see http://aws.amazon.com/ec2/pricing/ for the gory details (02:47:48 PM) kirkland: so let's disable the kernel version (02:47:48 PM) ClassBot: gsmx asked: where can you change the color of this kernel script? (02:47:55 PM) kirkland: chmod -x and then F5 (02:48:14 PM) kirkland: gsmx: you'd need to hack the color markup in line (02:48:37 PM) kirkland: gsmx: i have added documentation to the man page as to how to do this in the latest upstream release, though its not in 10.04 (02:49:33 PM) kirkland: okay, let's take a look at another useful notification for servers (02:49:42 PM) kirkland: let's say you want to monitor your daemon, if it's running (02:49:51 PM) kirkland: for grins, let's monitor "atd" on this system (02:49:57 PM) kirkland: yeah, not the most interesting service (02:50:11 PM) kirkland: but image it's some really important process you *must* have running on your server (02:50:28 PM) kirkland: in the manpage, i see the "services" option (02:50:44 PM) kirkland: it tells me to hack the SERVICES variable in the status file (02:51:11 PM) kirkland: so i add this: SERVICES="atd,atd" (02:51:48 PM) kirkland: whoops, i add this: SERVICES="atd|atd" (02:52:14 PM) kirkland: where this is a a whitespace separated of services, each service should include the init name of the service, then a pipe, and then an abbreviated name or symbol to display when running (02:52:45 PM) kirkland: so i find this useful on my server running ssh, apache, squid, rsync, ftp, etc. (02:53:03 PM) kirkland: there's just a few more minutes left... i'd like the open the floor for questions (02:53:19 PM) kirkland: perhaps suggestions of things you'd like to see in byobu in the future (if you're already a byobu user) (02:53:55 PM) kirkland: byobu (screen) seems cool and all that, but I feel that it's quite a scary topic for the average user when people mention byobu in the context of cloud computing, EC2-Amazon, virtualization, etc. Perhaps basic examples should be provided for those that aren't enterprise users. (02:54:00 PM) kirkland: i saw this comment ... (02:54:07 PM) kirkland: I hope I did give some non-scary examples (02:54:23 PM) kirkland: if you're at all familiar with the command line even a little bit, byobu should be very intuitive (02:55:50 PM) ClassBot: ubuntoogle asked: Can I apt-get install ubuntu-desktop and VNC into an EC2 instance and still get this bottom display? (02:56:10 PM) kirkland: ubuntoogle: you can, if i understand you correctly (02:56:24 PM) kirkland: ubuntoogle: though your vnc and your ssh connections will be separate (02:56:32 PM) kirkland: ubuntoogle: but once you've vnc (02:56:38 PM) kirkland: 'd in, you'd run a terminal (02:57:04 PM) kirkland: QUESTION: something nice to add would be custom pre-configured "new windows" for the F2 menu (02:57:10 PM) kirkland: JanC: actually, that's already there (02:57:23 PM) kirkland: JanC: F9 -> │ Create new windows │ (02:57:29 PM) kirkland: see the shared session (02:57:36 PM) kirkland: here, you can create a new window (02:57:48 PM) kirkland: and then F9 -> │ Manage default windows │ (02:58:00 PM) kirkland: here, you can toggle on/off your default windows (02:58:15 PM) kirkland: there's a bare set of 4 that are stock, but as you add more to your profile, they will show up here (02:58:25 PM) kirkland: and will just get commented out in your ~/.byobu/windows file (02:59:05 PM) kirkland: alrighty, guys, i'm about done (02:59:13 PM) kirkland: join us in #byobu if you have more questions (02:59:19 PM) kirkland: or just want to learn more about #byobu (02:59:27 PM) kirkland: there's a few people there besides myself who can hel (02:59:28 PM) kirkland: help (02:59:37 PM) kirkland: i think byobu makes the command line "fun" again :-) (02:59:51 PM) kirkland: so I appreciate you listening to me blabber on about it :-) (02:59:51 PM) akgraner: Thanks kirkland! Great Session!! }}}