Change the terminal prompt [duplicate]

This can be really trivial,but it helps in ways of making it more comfortable while coding and sending commands to terminal.

My terminal source/bash/root name(my apologies, I dunno which is the right word), reads as follows :

itachi@itachi-HP-Pavilion-g6-Notebook-PC:~$ 

Can you please tell me how Can I shorten this or change it? The second part after '@' is too long. Is there anyway to change this.? Thanks in advance..


Solution 1:

Run the following command in a terminal to open ~/.bashrc file:

gedit ~/.bashrc

When .bashrc opens, locate and uncomment force_color_prompt=yes (remove the hash, so it no longer looks like: #force_color_prompt=yes) and change the value of PS1 in something like:

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@<anything-you-want>\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

More about: http://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html

Solution 2:

The second part after the @ is the name of your computer. Change it!
Change it in 2 places:
sudo gedit /etc/filename
Replace 'filename' first by 'hosts' and then by 'hostname'
then find "itachi-HP-Pavilion-g6-Notebook-PC" and change it to a desired name. Make sure that the name you choose is without spaces.
Save the file.

Restart the computer and you are done! Samjha?