SharonKo
SharonKo

Reputation: 619

Command prompt change after reboot

I changed my command prompt using PS1="[\u@\h \W]\$ " but after reboot, it returns to be the default command prompt. How can I make this change to be permanent?

Upvotes: 2

Views: 761

Answers (3)

Chandru
Chandru

Reputation: 1334

Add this line PS1="[\u@\h \W]\$ " to the .bashrc file in your home directory.

If the bashrc is not open.

Then set export EDITOR="vim".

Upvotes: 1

Christian Ternus
Christian Ternus

Reputation: 8492

Add

PS1="[\u@\h \W]\$ "

to the file .bashrc (assuming your shell is bash) in your home directory.

You can do this with:

echo 'PS1="[\u@\h \W]\$ "'>>~/.bashrc

Minor background: PS1 is an environment variable - a variable that's set for your login session. .bashrc is a file that's read and interpreted by your shell every time it starts up, and you can use it to configure other attributes of the way your shell behaves.

For example, a common way to change your default editor is to add the line

export EDITOR="emacs"

to your .bashrc.

Upvotes: 1

eddie
eddie

Reputation: 190

Add this line PS1="[\u@\h \W]\$ " to the .bashrc file in your home directory.

Upvotes: 3

Related Questions