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"'

Reference: http://www.publicstatic.net/2011/02/09/setting-gnome-terminal-title-bash/

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

# Highlight make warnings and errors
make()
{
    pathpat="(/[^/]*)+:[0-9]+"
    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]}
}
Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s