PROMPT_COMMAND='echo -ne "\033]0;${PWD##*/}\007"'

Category: Terminal Configuration

PROMPT_COMMAND='echo -ne "\033]0;${PWD##*/}\007"'

Set the terminal tab title to the current directory name

PROMPT_COMMAND is a bash variable that runs a command before each prompt. The escape sequence \033]0;...\007 sets the terminal window/tab title. ${PWD##*/} strips the path to just the folder name. Useful when you have many tabs open.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.