The advice from helptonewbie is correct for setting the shell prompt. If you want to customize the title of the terminal window, again it depends from the shell you are using. In bash, you have to go through the PROMPT_COMMAND variable: it contains a command to execute before the prompt. As an example, on one system of mine - running GNOME and using BASH - I have
Code:
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\007"'
The blue part is what tells to customize the title of the terminal, where \033 is the ascii code for ESC and \007 is the ascii code for BELL. In other words when you have prompt commands like these
Code:
\033]0;any_string_here\007
\033]1;any_string_here\007
\033]2;any_string_here\007
the terminal title and icon name, or the icon name only, or the terminal title only, will be set to any_string_here respectively. In the example above the terminal and icon title will be dynamically set to
Code:
user@hostname:current_directory
The variable PROMPT_COMMAND is set in /etc/bashrc, but - as helptonewbie suggested - you can set its value in ~/.bashrc to override the system behavior on a per-user basis. The last step is to correctly setup the default profile used by the terminal: in gnome-terminal this can be done by clicking on Edit --> Current Profile --> Title and Command and set "Dinamically-set title" to "Replaces initial title".