LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to change my prompt ? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-change-my-prompt-121010/)

lzg8056 11-29-2003 12:09 PM

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

slakmagik 11-29-2003 12:19 PM

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.

r4merlin 11-29-2003 12:20 PM

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

lzg8056 11-30-2003 02:42 AM

ok thanks!

lzg8056 11-30-2003 05:18 AM

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!

tommytomato 11-30-2003 06:17 AM

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 :study:

lzg8056 11-30-2003 06:36 AM

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 :study:

My OS is RedHat9
I hope my prompt like yours "[root@www root]"

tommytomato 11-30-2003 06:46 AM

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
:study:

lzg8056 11-30-2003 07:10 AM

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
:study:

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.

tommytomato 11-30-2003 07:26 AM

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.:confused:

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 :study:

lzg8056 11-30-2003 07:42 AM

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 :study:

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?

tommytomato 11-30-2003 07:50 AM

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

lzg8056 11-30-2003 08:01 AM

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.........

slakmagik 11-30-2003 03:14 PM

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.

lzg8056 11-30-2003 09:00 PM

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


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