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 :


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

  • 2
    You edit / set your prompt in ~/.bashrc, there are several options. See the answer above as well as cyberciti.biz/tips/… You could also shorten your hostname. – Panther Jul 17 '13 at 3:45

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


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?

  • Thanks for additional info :). It worked with the previous answer too. This is good info to know :). – Lakshmi Narayanan Jul 18 '13 at 13:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.