LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-05-2003, 01:10 PM   #1
everythingand2
Member
 
Registered: Oct 2003
Location: Kansas City, MO
Distribution: Slackware 9.1
Posts: 61

Rep: Reputation: 15
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
 
Old 10-05-2003, 01:17 PM   #2
CrAZy_MoNKeY
Member
 
Registered: Mar 2003
Posts: 64

Rep: Reputation: 15
to change your hostname run -
# netconfig
 
Old 10-05-2003, 01:23 PM   #3
everythingand2
Member
 
Registered: Oct 2003
Location: Kansas City, MO
Distribution: Slackware 9.1
Posts: 61

Original Poster
Rep: Reputation: 15
That worked, thanks for the help...

...still needing help with the prompt though, anyone?
 
Old 10-05-2003, 01:38 PM   #4
Skyline
Senior Member
 
Registered: Jun 2003
Distribution: Debian/other
Posts: 2,104

Rep: Reputation: 45
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.
 
Old 10-05-2003, 01:40 PM   #5
everythingand2
Member
 
Registered: Oct 2003
Location: Kansas City, MO
Distribution: Slackware 9.1
Posts: 61

Original Poster
Rep: Reputation: 15
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>"

Last edited by everythingand2; 10-05-2003 at 01:43 PM.
 
Old 10-05-2003, 04:19 PM   #6
Looking_Lost
Senior Member
 
Registered: Apr 2003
Location: Eire
Distribution: Slackware 12.0, OpenSuse 10.3
Posts: 1,120

Rep: Reputation: 45
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.
 
Old 10-05-2003, 06:12 PM   #7
eltongeoff
Member
 
Registered: Mar 2003
Posts: 76

Rep: Reputation: 15
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
 
Old 12-06-2003, 04:28 PM   #8
SerfurJ
Member
 
Registered: May 2003
Posts: 80

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


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash prompt subG Slackware 6 01-18-2006 04:43 PM
Changing Bash Prompt socks Slackware 11 02-09-2005 06:32 PM
Changing the BASH prompt? Dravis Linux - Software 2 01-22-2004 09:17 PM
Bash Prompt mandraketux Mandriva 2 11-28-2003 10:05 PM
Customize BASH Prompt kleptos Linux - Newbie 15 01-02-2003 12:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration