How to Renaming the Terminal Tabs?

workspace
terminal

#1

Hi guys,

Is it possible to rename the Terminal Tabs? Like the terminal on my machine?

Thanks


#2

you can add the following function to your bashrc

setTitle() {
    # configure tmux to allow xterm set title sequence
    tmux set-window-option automatic-rename off
    tmux set-option allow-rename off 
    tmux set-option set-titles-string "#T"
    tmux set-option set-titles on
    # set terminal title
    echo -ne "\033]0;$@\007"
}

and then run setTitle “my terminal name”.

Sometimes bash prompt (PS1) contains \033]0;...\007 as well, in that case you need to modify it to not allow overriding the title set by setTitle function
Also you may need to remove the old version of tmux from /usr/bin by running sudo apt-get remove tmux, to not allow it interfering with the version from /mnt/shared/sbin


Allow Terminal Tab Custom Naming
#3

I have added your snippt. Opened a new terminal and ran # setTitle “Console” Nothing happens, title still the same.

Terminal title flicks and I can see it changes to Console but as if something else overrides it and goes back to ubuntu@houman…

I have also remove the tmux

Any suggestions?


#4

Ok, I found What is overriding it.
This one on the Bashrc:

#if this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

I commented it out and all good now.

Thanks again