Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
#! /bin/sh
echo "$(byobu ls|grep attached)"|sed 's/\([a-zA-Z0-9][a-zA-Z0-9]*\).*/\1/'

this is my script in ~/.byobu/bin/ refresh time is 1 second.

This shows the session name as the custom status,but it does so for all but 1 session.In place of showing the session name it shows ]0 for that session.

Is it some issue with the echo command ?

share|improve this question
up vote 1 down vote accepted

The problem can be found when you do Byobu ls |grep attached >> ~/byobu_out.

When you cat this file the output is normal i.e


but when you open it in vi then you see that the file is like this:

^[]0;[user@host](x.x.x.x)] - byobu^Gsession1name:details

So when you pass this output through sed it stops at ]0.

To overcome this use tail -c +x [filename] to see the output, where x is the number of byte of the junk header.

Also the junk header is nothing but the title of the window of the byobu terminal.

share|improve this answer
it's me with who solved it in the end...accidentally made two accounts...any one knows how to merge them? – Anurag Nov 2 '12 at 13:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.