Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Shell prompt Not displaying properly

Posted on 2004-09-14
10
Medium Priority
?
344 Views
Last Modified: 2013-12-06
Hi,
  I am having a slight problem , the shell prompt when i log in does not show the user name or the dir i am presently in , it only show me
 

  bash-2.05b$

Thank you,
Bibin

 
0
Comment
Question by:bibinbhanu
[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
  • 4
  • 3
10 Comments
 
LVL 11

Expert Comment

by:avizit
ID: 12061400
you can change the prompts by setting the

PS1 variable
you can put

export PS1="\w> "

in your .bash_profile to have the current working directory on the prompt

similarly
\u for username etc


0
 
LVL 11

Accepted Solution

by:
avizit earned 200 total points
ID: 12061407
from ftp://ftp.cwru.edu/pub/bash/FAQ

G5) How do I get the current directory into my prompt?

Bash provides a number of backslash-escape sequences which are expanded
when the prompt string (PS1 or PS2) is displayed.  The full list is in
the manual page.

The \w expansion gives the full pathname of the current directory, with
a tilde (`~') substituted for the current value of $HOME.  The \W
expansion gives the basename of the current directory.  To put the full
pathname of the current directory into the path without any tilde
subsitution, use $PWD.  Here are some examples:

      PS1='\w$ '      # current directory with tilde
      PS1='\W$ '      # basename of current directory
      PS1='$PWD$ '      # full pathname of current directory

The single quotes are important in the final example to prevent $PWD from
being expanded when the assignment to PS1 is performed.

0
 

Author Comment

by:bibinbhanu
ID: 12061485
I am not able to find my .bash_profile
0
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 
LVL 11

Expert Comment

by:avizit
ID: 12061505
try

ls -la  

if you dont have > .bash_profile

then you can create one

vi or emacs .bash_profile    

( in you home directory btw )

0
 

Author Comment

by:bibinbhanu
ID: 12061535
could anybody send me a sample bash_profile , I am using Red hat 9
0
 
LVL 11

Expert Comment

by:avizit
ID: 12061551
there is a sample .bash_profile at

http://www.ccl.net/cca/software/UNIX/oracle/RH6.2-CDPACK/files/bash_profile.shtml
http://www.hccfl.edu/pollock/AUnix1/BashProfile.htm


you need not have such bigones.. just set the values which are necessary to you

0
 
LVL 10

Expert Comment

by:Luxana
ID: 12061589
have a look like root to /etc/passwd

what is your deafault shell you should have there somethhing like this:
root:x:0:0:root:/root:/bin/bash
or check your user account last field separated witn ':' is your default shell

also have a look here:
-------------------

/etc/profile
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

PATH="/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games"

if [ "$BASH" ]; then
  PS1='\u@\h:\w\$ '
else
  if [ "`id -u`" -eq 0 ]; then
    PS1='# '
  else
    PS1='$ '
  fi
fi

export PATH PS1

umask 022
for mor info have a look to man page:

# man bash
---------------------------

luxana

0
 

Author Comment

by:bibinbhanu
ID: 12061719
Thanks for all the help ,
  I figured out that I had tried to install a pdf as root which probably was a spy ware or something and ehich may ahve deleted the profile.
  I created a new account and copied all the necessary file to my dir.
  .bashrc
  .bash_profile
      etc...

  :)

Thank you
Bibin
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

636 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