change prompt of terminal, permanently | how

by user8324   Last Updated November 21, 2017 12:02 PM

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 ?

Answers 2

  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:~$

June 19, 2012 06:39 AM

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.

June 19, 2012 06:42 AM

Related Questions

"export PS1=" for customizing shell prompting

Updated December 07, 2017 11:02 AM

problem setting up bash_profile

Updated February 20, 2017 10:02 AM

Prepend current git branch in terminal

Updated October 31, 2017 04:02 AM

Difference between $ and # in Linux environment

Updated January 17, 2018 17:02 PM