function iterm_tab_title() {
  if [ "$1" ]
  then
    unset PROMPT_COMMAND
    echo -ne "\033]0;${*}\007"
  else
    export PROMPT_COMMAND='echo -ne "\033]0;${PWD/#$HOME/~}\007"'
  fi
}

Allow quickly to label iTerm tab
Allow quickly to label iTerm tab
