Solved

Linux prompt

Posted on 2004-04-01
12
16,715 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
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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
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 …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
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.

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now