LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to change appearance in terminal? (http://www.linuxquestions.org/questions/linux-newbie-8/how-to-change-appearance-in-terminal-606288/)

ab25 12-12-2007 08:59 AM

how to change appearance in terminal?
 
Dear friends,

I want to change the appearance of terminal/ bash shell. I want to put my name at the begining of the bash shell/terminal every time its opened.(So I like to put anything at the beginning of the skin of terminal).How can I manage to do it? How can I change the appearance of terminal permanently?
regards

helptonewbie 12-12-2007 09:27 AM

Hello,
It depends on the shell you are using, for bash you can edit the .bashrc for yourself and add in the following:

PS1="MyNameIS >"


something like that will mean in any bash shell you open you will see:
MyNameIS >
as the prompt.
Use this website to help you:
http://lantech.geekvenue.net/chuckti...302/index_html
Regards

ps-you could make it system wide by editing your /etc/profile, however the .bashrc of a user will override this i think?!?

colucix 12-12-2007 10:08 AM

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


All times are GMT -5. The time now is 08:45 PM.