Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I change prompt name seen at terminal ?

my prompt :


It is too long. I want to change it as :

gcc : 

However, I should see path when I have go from one directory to another.

gcc :~$ cd X_directory
gcc :~/X_directory$

How can I do that, permanently ?

share|improve this question
up vote 8 down vote accepted

Test it with this:

export PS1="gcc :\w\$ "

If if its what you want, then change it in your .bashrc file:

gksu gedit .bashrc

delete or comment out this line:

PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '

and replace with

PS1='gcc :\w\$ '
  • note if your username is "gcc" then you could replace gcc with \u

Hope that helps. More info on PS1 here.

share|improve this answer
  1. First, open a terminal and type:

    root@penreturns:~$ gksu gedit /etc/hostname

You should see a line stating your current hostname. For eg. iPad

  1. Change the hostname to something you desired. Save and close the file.

  2. Back in your terminal, type:

    root@penreturns:~$ gksu gedit /etc/hosts

  3. Change the line: iPad

to your-new-hostname

Save and close the file.

Reboot and your new hostname should appear in the terminal now.

*copy code without root@penreturns:~$

share|improve this answer
Does this requirement (and question) really justify changing the hostname? – david6 Jun 19 '12 at 9:34
for this " <user_name>@<user_name>-MEGA-BOOK-VR320:~$ " my answer is yes – penreturns Jun 19 '12 at 9:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.