how to run multiple byobu sessions at once?
Solution 1:
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.
Solution 2:
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
.
Solution 3:
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.
Solution 4:
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.