57

Currently I don't seem able to run multiple sessions of byobu. After the initial byobu instance, running on one terminal, when I run byobu in another terminal it always attaches to the first byobu session.

Is there away to start independent byobu sessions?

5 Answers 5

73
+50

It is very easy. (At least on my ubuntu 10.04 machine, where byobu uses screen.);

If you already have one session running, and do not want to reattach but instad create a new one, just type:

byobu -S my-other-session

Where my-other-session is how you are naming the new session.

Later, if you have already more than one byobu sessions running, it is sufficient to type

byobu

And you will be presented with a list of running sessions to choose from:

Byobu sessions...

  1.  17680.my-other-session (03/12/2012 01:33:32 PM) (Detached)
  2.  11890.pts-2.mit        (01/15/2012 09:17:49 AM) (Detached)
  3.  Create a new session

Choose 1-3 [1]:

If typing byobu dos not present a list of running sessions to choose from, try the byobu-select-session command.

The pts-2.mit session was the one I created initially without giving it a name, so the name was chosen by boybu.

If you want to find out which sessions are running, without attaching to any of them, use

byobu -ls

It drops you again at the console where you typed it after showing a list like:

There are screens on:
        17680.my-other-session  (03/12/2012 01:33:31 PM)        (Detached)
        11890.pts-2.mit         (01/15/2012 09:17:48 AM)        (Detached)
2 Sockets in /var/run/screen/S-root.
1
9

Use the -S option to give your next byobu session (e.g. its socket) a different name. Without -S "MYNAME" the socket would be <pid>.<tty>.<host> instead of <pid>.MYNAME.

8

As far as I can work out, if you run byobu with no arguments then it reattaches to an existing session (or starts a new one if you aren't running byobu at all). If you run it with a program name as the argument then it will pass this to either screen or tmux, depending on what you are running inside.

If you're running screen, you can simulate starting a fresh session (executing your shell) by running byobu byobu-shell (byobu-shell being the program that byobu launches by defualt. It prints the MOTD and launches your $shell.). Then when you try to reattach, either by running byobu or reconnecting via SSH to the server, you'll be given a menu with options to choose between the running byobu sessions.

For tmux, execute byobu new-session to achieve this. The next time you reconnect you'll be attached to the last session you started.

10
  • :Thanks for your reply. But running byobu $shell just reattaches to the already running session (this is because $shell is not defined/blank in the terminal). While running byobu byobu-shell just gives prints that byobu-shell is an unrecognised command. (Sorry if I have misunderstood what you said...)
    – hargriffle
    Jan 11, 2012 at 11:17
  • What release are you running? byobu-shell is in Oneiric and newer. You can run byobu bash (or zsh or whatever) to get roughly the same effect.
    – Iain Lane
    Jan 11, 2012 at 11:31
  • I am running ubuntu 10.04, byobu version 5.2 and tmux 1.5. And, unfortunately, both byobu bash and byobu zsh given "unknown command" errors. Is it perhaps something in my old screen set up? Any ideas?
    – hargriffle
    Jan 11, 2012 at 11:40
  • I can't easily test Lucid I'm afraid, but if you're up for it you could install a newer version from the PPA: launchpad.net/~byobu/+archive/ppa/+packages
    – Iain Lane
    Jan 11, 2012 at 11:41
  • 1
    The command I wanted was "byobu-disable", then reconnect as many times as you need. This isn't a solution to the precise OP, but it allows two different terminal sessions at once (without byobu), which is all I need. Feb 24, 2012 at 12:02
2

If you're connecting to a machine using ssh and you'd like to create a new byobu session, use:

ssh -t hostname byobu new-session

Note: The -t flag is needed to "Force pseudo-terminal allocation" otherwise you get the following error: "open terminal failed: not a terminal"

Once you have created the new session on a machine on any subsequent connection you'll be asked which byobu session you'd like to attach to.

1

Or, when you are inside a byobu session already: Ctrl+Shift+F12.

1
  • This appear to be incorrect as that key combination opens the Mondrian squares instead
    – Skgland
    Oct 4, 2023 at 11:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .