LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   help with bash prompt (https://www.linuxquestions.org/questions/linux-newbie-8/help-with-bash-prompt-100514/)

everythingand2 10-05-2003 01:10 PM

help with bash prompt
 
Hello...

I've just installed Slackware on my machine and I'm wanting to change the bash prompt to display something other than the hostname. I've read that creating a .bashrc file in the /etc directory with the PS1 variable set in it will set the prompt universally. Is this correct?

I've tried it but I can't get it to work at all. I've even tried rebooting to see if the changes would be reflected then. The only thing I can do is change it dynamically...but not permanently.

Also, I want to change the hostname of my machine. How do you do this and make it permanent? Thanks in advance for the help.

- Brad

CrAZy_MoNKeY 10-05-2003 01:17 PM

to change your hostname run -
# netconfig

everythingand2 10-05-2003 01:23 PM

That worked, thanks for the help...

...still needing help with the prompt though, anyone?

Skyline 10-05-2003 01:38 PM

To alter your prompt - add a line to your ~/.bashrc – its a hidden file - for example

PS1=”\w Hello $”

You need to check out the options for prompt string 1 for more info.

everythingand2 10-05-2003 01:40 PM

I have a line similar to that in my .bashrc file but it still doesn't alter anything. I'm stumped.

My current prompt reads bash-2.05b#.

My .bashrc file is set to PS1="\u@\H:\w>"

Looking_Lost 10-05-2003 04:19 PM

You've got the .bashrc in your home directory, do you have a .bash_profile with entries to run .bashrc ?

You can of course put the alter the PS1 stuff in /etc/profile too to make it global

Side note aswell - if you're opening an xterm or whatever terminal in a GUI use xterm -ls so that the prompt etc. are picked up the way you want.

eltongeoff 10-05-2003 06:12 PM

ok a few things.
do export PS1='.......' and u should c your prompt change. of course replace those dots with wutever u want. now, this is only for that particular bash session. if u exit or open a new terminal, it'll go back to the default. want u want to do is to edit the .bashrc file in your homedirectoy. put the line export PS1='.....' in there, there should already b an existing PS1 entry in there so just edit. now, after saving and exiting, u need to do source ~/.bashrc and your prompt will change. the last thing u need to do is to check your .bash_profile file also in your home directory and u need in there source ~/.bashrc it may b commmented out, so just uncomment it. now u should b all set

SerfurJ 12-06-2003 04:28 PM

don't forget to source the .bashrc file. i had the same problem. see my post:
http://www.linuxquestions.org/questi...hreadid=120121


All times are GMT -5. The time now is 05:11 PM.