Give a specific name to a terminal tab instance [duplicate]

I wrote a function for that once.

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

Alternatively, one could use

 "\033]0;$@\a"

Using that in conjunction with PROMPT_COMMAND variable in ~/.bashrc or PS1 variable, you can do something like this:

PS1="$PS1$(setTitle $(date) )"

What this does is thatbit adds timestamp to title of the terminal each time you propt redrawing is called. So each of your tabs can have timestamp the last command got executed.

From there, you can add other forms of commands in $() instead of date. Or have it be called from ~/.bashrc once at the end of the file to only have non changing prompt through the session but unique for each tab.

See also: How to change the title of the current terminal tab using only the command line