Solved

Linux prompt

Posted on 2004-04-01
12
16,726 Views
Last Modified: 2013-12-06
Hi all,

i m using  RED HAT LINUX 9.0  and it gives me # as default prompt, how can i change it $ ?
0
Comment
Question by:perlmn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
12 Comments
 
LVL 45

Expert Comment

by:sunnycoder
ID: 10731631
Hi perlmn,

In your ~/.bash_profile add a line
PS1=$'[\\u@\\h \\W]\\$
and after that export PS1 ....

on your command prompt execute

. ~/.bash_profile

Sunnycoder
0
 
LVL 24

Expert Comment

by:fridom
ID: 10732195
Well it very much looks as if he's working under the root account. I would not want to have  a root shell having the same prompt as  a "normal" user....

Regards
Friedrich
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 10735402
Friedrich is right, there is a reason why the root prompt looks different than a normal prompt. Try to log in as normal user, and see if the prompt you get is different (it very likely is). You should use Sunnycoder's method only to modify the prompt for a normal user, and never for the root user. You need to be able to see right away that you are logged in as root, because you can do a lot more damage to your system as root user. So everytime you see the '#' prompt, be extra careful.
0
Interactive Way of Training for the AWS CSA Exam

An interactive way of learning that will help you visualize core concepts so that you can be more effective when taking your AWS certification exam.  Built for students by a student to help them understand the concepts that they are being taught.

 
LVL 9

Expert Comment

by:majorwoo
ID: 10736182
my personal favorite is:


###begin .bashrc file###

# Do not set PS1 for dumb terminals
if [ "$TERM" != 'dumb'  ] && [ -n "$BASH" ]
then
        export PS1='\[\033[01;31m\]\u@\h \[\033[01;34m\]\W \$ \[\033[00m\]'
fi

###end .bashrc file###
0
 
LVL 17

Expert Comment

by:owensleftfoot
ID: 10736342
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 10744014
so much fun with a simple prompt :)



And as I see, most commentators do not cd to
 /this/dirwithalongnameandprobablyapproxiamtely90characterslongwhichwillmakethepromptveryusefull

*SCNR*
0
 

Expert Comment

by:Pizentios
ID: 10784536
your definatly running as root.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 10785110
Pizentios, how would you proof that (except you have been logged in to perlmn's system)?
0
 

Accepted Solution

by:
Pizentios earned 125 total points
ID: 10785273
well, for one, i doubt that red hat would by default make the normal user prompt look like root, unless red hat has gotten stupid since i last used it. Where i come from, # is reserved for the root prompt and all other users use $. I have never seen any normal user have # for a prompt, even users that belong to the wheel group. It'd be nice if we got a reply with more information from perlmn about his system.

Perlmn:

Did you install it yourself? or did sombody else do it for you. If it was sombody else they might have changed your prompt on your normal user account for some reason to look like a root prompt. Although i don't know why they would.

Do you login as root? if so, you should really create a user account and use it instead of always been root, it's much safer. To create a new user account, it's somthing like adduser or somthing like that, although it might be different since i haven't used red hat in quite a few years.
0
 

Author Comment

by:perlmn
ID: 10822674
Hi All

Many thanx to all of you, after your responses, I verified and I came to know that it was really root using # prompt  :-)

thanx again for u r great help



0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 10824787
perlmn, could you please explain how the graded answer helped you to change the prompt?
0
 

Expert Comment

by:Pizentios
ID: 10825239
he didn't need to change the prompt....he was just loged in as root instead of a normal user.


-Pizentios
0

Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you use Debian 6 Squeeze and you are tired of looking at the childish graphical GDM login screen that is used by default, here's an easy way to change it. If you've already tried to change it you've probably discovered that none of the old met…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question