1

I see that there are ways to set the tabs title through the CLI, but how can I give each tab its own "title"?

  1. top
  2. pine
  3. git

by default, gnome-terminal seems to show <user>@<host>:<path>, which gets cumbersome beyond two tabs, IMHO.

(creating umpteen profiles is way to awkward to be a solution)

Notably, Alpine seems to magically (through the CLI?) set the tab title:

enter image description here

  • I am not sure, if this works for you (can't test it right now...), but try to do a right-click on the title of the tab. There may be an option to change the title – Wayne_Yux Feb 4 '16 at 15:02
  • no such option for me – Thufir Feb 19 '16 at 12:25
2

As taken from SuperUser.com,

The process is a little complex to explain here since it is different for every shell you use. Rather I'll give you two links:

There are a few other things to take into consideration. For a one time change common to all terminal sessions, you may want instead to simply alter Bash (if you use bash and under gnome) icon and add --title=title under Gnome.

1

The title can be set using escape sequences as shown in How to change xterm title. ( Specifically for bash ).

In their example, they use case statement that sets PS1 with an enclosed escape sequence.

case $TERM in
    xterm*)
        PS1="\[\033]0;\u@\h: \w\007\]bash\\$ "
        ;;
    *)
        PS1="bash\\$ "
        ;;
esac

The basic idea is to echo echo -e "\033]0; STRING\007" ( The PS1 prompt needs extra \[...\] brackets to enclose the escape sequence ). Thus you could add the following function to your .bashrc at the top of the file:

function setTitle
{
   echo -e "\033]0;$@\007"
}

Now you can alter title at will

1

You could install and use xttitle (Note the doubled t in the name). I use it like this in a file sourced by my ~/.bashrc:

# from the "xttitle(1)" man page - put info in window title
update_title()
{
    [ $TERM = xterm -o $TERM = xterm-color ] && xttitle "[$$] ${USER}@${HOSTNAME}:$PWD"
}

cd()
{
    [ -z "$*" ] && builtin cd $HOME
    [ -n "$*" ] && builtin cd "$*"
    update_title
}

I also do this:

xttitle Mutt && mutt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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