?
Solved

Linux prompt

Posted on 2004-04-01
12
Medium Priority
?
16,728 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
Amazon Web Services EC2 Cheat Sheet

AWS EC2 is a core part of AWS’s cloud platform, allowing users to spin up virtual machines for a variety of tasks; however, EC2’s offerings can be overwhelming. Learn the basics with our new AWS cheat sheet – this time on EC2!

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

TCP/IP Network Protocol Cheat Sheet

TCP/IP is a set of network protocols which is best known for connecting the machines that make up the Internet. The truth is that TCP/IP is one of the oldest network protocols and its survival is mainly based on its simplicity and universality.

Question has a verified solution.

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

The purpose of this article is to demonstrate how we can use conditional statements using Python.
Fine Tune your automatic Updates for Ubuntu / Debian
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses

719 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