Wednesday, November 18, 2015

Useful Byobu Commands

Using the terminal in Linux is a must, but sometimes it is a little restricting (especially when logged in over an SSH session). Screen has been a longtime solution for these limitations, providing a terminal user some simple commands to switch among terminal sessions and easily keep sessions running in the background, but recently I have been using Byobu instead. Byobu is built on Screen as well as another solution called tmux.

Byobu is just a slightly fancier implementation of Screen but I have found that the commands can sometimes be a little difficult to nail down because sometimes the commands come from Screen and sometimes they come from tmux. So I am collecting the most useful commands and solutions for dealing with situations that I can find in this post.

Starting Byobu from the command line is easy--just type in byobu and it fires up. To have it start automatically, type byobu-enable and to disable this type byobu-disable. I find that byobu is most useful on the desktop PC that I ssh into, but not as much on the latptop I use daily because I can handle most of what I need to do there using multiple tabs in terminal. Also, if Byobu is running locally and on the remote host then there are two of the status screens at the bottom of the window, which can get confusing.

When using Byobu, the following commands are useful:

  • F2 - start a new window
  • F3/F4 - switch among the open windows
  • F6 - detach from the session and logout of the remote host (so you can disconnect while something is running and reconnect later--when you reconnect to the remote host with Byobu the session will be there waiting for you).
  • F8 - rename the window
  • F9 - bring up help and configuration menu
  • Shift-F12 - toggle Byobu's interception of the function keys (e.g. F3, F6) so you can use them in the program you are running.
I also find that sometimes I get fouled up with multiple sessions running. Switching between windows is easy with the F3/F4 keys, but multiple sessions sometimes gets difficult. The following commands are useful:
  • byobu list-sessions - type this to see a list of the sessions that are currently running.
  • byobu ls - same as byobu list-sessions
  • byobu choose-session - type this to get prompted for which session you would like to use.
  • byobu kill-session - kills the current session
To connect to a remote host that has Byobu running automatically without using Byobu in this session, connect with ssh -t hostname bash.

No comments:

Post a Comment