Set gnome-terminal title to current directory

It gets difficult when you’ve got a pile of terminal windows open with the same name. Took me a while to find this:

  • Edit > Profile Preferences > Title and Command
    Then set ‘When terminal commands set their own titles’ to ‘Replace initial title’
  • In your home directory add the following line to .bashrc:

    PROMPT_COMMAND='echo -ne "33]0;${USER}@${HOSTNAME}: ${PWD}07"'


Edit: This is also worth adding to your .bashrc at the same time…

# Highlight make warnings and errors
    ccred=$(echo -e "33[0;31m")
    ccyellow=$(echo -e "33[0;33m")
    ccend=$(echo -e "33[0m")
    /usr/bin/make "$@" 2>&1 | sed -E -e "/[Ee]rror[: ]/ s%$pathpat%$ccred&$ccend%g" -e "/[Ww]arning[: ]/ s%$pathpat%$ccyellow&$ccend%g"
    return ${PIPESTATUS[0]}

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s