LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 11-29-2003, 12:09 PM   #1
lzg8056
LQ Newbie
 
Registered: Nov 2003
Posts: 8

Rep: Reputation: 0
how to change my prompt ?


my prompt is "bash-2.05b#" , but I don't like it , so how to change it and which file should I compile ? how to compile?
I want a prompt like this : " [root@ myname root]#"

thanks

Last edited by lzg8056; 11-29-2003 at 12:10 PM.
 
Old 11-29-2003, 12:19 PM   #2
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
Welcome to LQ and Use the Search, Luke! There's a thread about 'What's your prompt look like' and many many references to configuring the prompt besides that.

Also a compiling guide somewhere - I forget where - maybe in the Linux Answers section.

-- Oh, that was one question. You don't 'compile' your PS1 string - you just edit the file. You compile source code to produce binaries.

Last edited by slakmagik; 11-29-2003 at 12:20 PM.
 
Old 11-29-2003, 12:20 PM   #3
r4merlin
LQ Newbie
 
Registered: Nov 2002
Distribution: Redhat 9
Posts: 24

Rep: Reputation: 15
You set it in .bashrc file Have a look round for some tutorials on it. (Shell prompt)

Last edited by r4merlin; 11-29-2003 at 12:25 PM.
 
Old 11-30-2003, 02:42 AM   #4
lzg8056
LQ Newbie
 
Registered: Nov 2003
Posts: 8

Original Poster
Rep: Reputation: 0
ok thanks!
 
Old 11-30-2003, 05:18 AM   #5
lzg8056
LQ Newbie
 
Registered: Nov 2003
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by digiot
Welcome to LQ and Use the Search, Luke! There's a thread about 'What's your prompt look like' and many many references to configuring the prompt besides that.

Also a compiling guide somewhere - I forget where - maybe in the Linux Answers section.

-- Oh, that was one question. You don't 'compile' your PS1 string - you just edit the file. You compile source code to produce binaries.
yeah, you are right .
But I have done it ,and I have read the torpic of the 'What's your prompt look like'. I spend some time on it ,but I can't undestand any code yet ! So I don't know what should I do . I have used the " alias ls= 'ls --color' to change my LS display ,and it worked well. In my ROOT home directory , I can't find the '.bashrc' file, and I have readed the /etc/DIR_COLORS and /etc/profile.d/ *.sh , I don'd know how to do it ! Crying



My system is redhat9, I need your help, please give me details.
Thanks!
 
Old 11-30-2003, 06:17 AM   #6
tommytomato
Member
 
Registered: Nov 2003
Location: Narrogin Western Australia
Distribution: GUI Ubuntu 12.04 - Server 12.04.4 LTS
Posts: 939

Rep: Reputation: 32
Do you want your host name there is stead of the one you have.

mine is like so [root@www root]

What OS are you using ?

tommytomato

Last edited by tommytomato; 11-30-2003 at 06:25 AM.
 
Old 11-30-2003, 06:36 AM   #7
lzg8056
LQ Newbie
 
Registered: Nov 2003
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by tommytomato
Do you want your host name there is stead of the one you have.

mine is like so [root@www root]

What OS are you using ?

tommytomato
My OS is RedHat9
I hope my prompt like yours "[root@www root]"
 
Old 11-30-2003, 06:46 AM   #8
tommytomato
Member
 
Registered: Nov 2003
Location: Narrogin Western Australia
Distribution: GUI Ubuntu 12.04 - Server 12.04.4 LTS
Posts: 939

Rep: Reputation: 32
Quote:
I hope my prompt like yours
you lost me there.

when one reinstalls redhat 9.0 you have the option to set your host name
under the network configuration.

I just came across this, is it any help to you ?

http://www.cpqlinux.com/hostname.html

tommytomato
 
Old 11-30-2003, 07:10 AM   #9
lzg8056
LQ Newbie
 
Registered: Nov 2003
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by tommytomato
you lost me there.

when one reinstalls redhat 9.0 you have the option to set your host name
under the network configuration.

I just came across this, is it any help to you ?

http://www.cpqlinux.com/hostname.html

tommytomato
thank you .

let me tell you what has hapened, when I upgraded my openoffice, I have used the "openoffice--repair " tools to uninstall it and then install the newest one, which is version 1.1 you know . But it didn't work with my wish and some bad things hapened , when I reboot my system, and ran the terminal , the prompt has changed form "[root@www root]" to "bash-2.05b$" ,but I don't like this style . In the home directory there are usually some files such as .bashrc .dir_color etc. but I could't find them after I upgraded my openoffice.
 
Old 11-30-2003, 07:26 AM   #10
tommytomato
Member
 
Registered: Nov 2003
Location: Narrogin Western Australia
Distribution: GUI Ubuntu 12.04 - Server 12.04.4 LTS
Posts: 939

Rep: Reputation: 32
i think this is what digiot was talking about.


http://www.linuxquestions.org/questi...121#post596121


i think you can change it using webmin under host address.

i also have mine like this. [root@rockinghamgateway root]

that was adding my host name with out the (www) comes up like so [root@rockinghamgateway root]

adding the www in front will show your prompt like so [root@www root]

I think the system auto sets it that way, well it does on fedora core from what i noticed.

I'm sure if you ask more Q's some one will fill you in .

tommytomato

Last edited by tommytomato; 11-30-2003 at 08:08 AM.
 
Old 11-30-2003, 07:42 AM   #11
lzg8056
LQ Newbie
 
Registered: Nov 2003
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by tommytomato
i think this is what lzg8056 was talking about.


http://www.linuxquestions.org/questi...121#post596121
I hope my prompt like yours

you lost me there.

tommytomato
My meaning is I want to have this style rather yours, you know ?

thanks , I have readed this thread and replies.

I know your meaning, and your tips is very good , but I don't know how to write code, can you understand my meaning? My questions is how to change prompt and which files can i do that?

Last edited by lzg8056; 11-30-2003 at 07:48 AM.
 
Old 11-30-2003, 07:50 AM   #12
tommytomato
Member
 
Registered: Nov 2003
Location: Narrogin Western Australia
Distribution: GUI Ubuntu 12.04 - Server 12.04.4 LTS
Posts: 939

Rep: Reputation: 32
Yes i get your point.
I have not had to change my host name via the linux command line yet.
I know its hard, but you may have to read and learn how to use the command line.

these links should get you started with linux, it wont happen over night.it took me three months before it made sence to me.

http://linux-newbie.sunsite.dk/index.html

http://www.martian-tech.com/commands.html

http://www.diywebserver.com/index.php

http://tardis.csudh.edu/linux/commands/


cheers tommytomato
 
Old 11-30-2003, 08:01 AM   #13
lzg8056
LQ Newbie
 
Registered: Nov 2003
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by tommytomato
Yes i get your point.
I have not had to change my host name via the linux command line yet.
I know its hard, but you may have to read and learn how to use the command line.

these links should get you started with linux, it wont happen over night.it took me three months before it made sence to me.

http://linux-newbie.sunsite.dk/index.html

http://www.martian-tech.com/commands.html

http://www.diywebserver.com/index.php

http://tardis.csudh.edu/linux/commands/


cheers tommytomato
thanks a billion !!!

applauding.........
 
Old 11-30-2003, 03:14 PM   #14
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
Not sure about the open office stuff and tommytomato's probably got you covered (so this post may be pointless), but I see how that thread I referred to (yep, that was it, tommytomato) wouldn't make much sense without context. If less is your manpager (and maybe otherwise) you can do 'man bash' and then hit the slash key (/) and type PROMPTING and it'll define all those variables. You just plug them in how you want them.

Try 'man hostname' if you want to do something with that - I usually just set it during the install and don't pay much attention after that but it seems like I did change it before.

As far as not having a .bashrc (or a .bash_profile), it's not required, in that /etc/profile takes care of base initialization. But it's just a plain text file - create it and add in your prompt strings, aliases, functions, other environmental variables. Other than functions, it's not really 'programming' and nothing too hard - basically you're just saying 'I want *this* to mean *that*.' Like I change to /var/log/packages a lot and that's a bit to type and tab completion isn't perfect, and there is no 'cdp' command. So I can 'make' one by saying 'alias cdp='cd /var/log/packages''. Now that I've told bash what it 'means', when I type 'cdp', bash 'translates it' to 'cd /var/log/packages'. And like with the prompt string - I'm saying I want PS1 to be equal to 'string', and the string, in turn, is made up of more variables - part of my prompt string is '\w' which just means to display the present working directory in the prompt. Like that.

Never heard of a Linux program clobbering files like that, though. Might want to make a ~/.bashrc and do 'cp .bashrc .bashrc.mybak' so that you have a pretty unclobberable backup. Some text editors make them anyway, depending on the default setup, but those can get overwritten in turn.
 
Old 11-30-2003, 09:00 PM   #15
lzg8056
LQ Newbie
 
Registered: Nov 2003
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by digiot
Not sure about the open office stuff and tommytomato's probably got you covered (so this post may be pointless), but I see how that thread I referred to (yep, that was it, tommytomato) wouldn't make much sense without context. If less is your manpager (and maybe otherwise) you can do 'man bash' and then hit the slash key (/) and type PROMPTING and it'll define all those variables. You just plug them in how you want them.
.......................................
yeah!!
that is my points~
thanks
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
change the shell prompt ust Linux - Distributions 5 04-28-2005 03:26 PM
how to change login prompt ChronusDark Linux - General 2 03-03-2005 01:34 AM
change the boot prompt alaios Linux - Newbie 1 07-30-2004 10:23 PM
How can I change the terminal prompt? ICO Slackware 4 02-15-2004 08:09 AM
how to change prompt ashesh Linux - General 5 04-16-2003 06:14 PM

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

All times are GMT -5. The time now is 06:37 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration