Solved

Shell prompt Not displaying properly

Posted on 2004-09-14
10
335 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
  • 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 50 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying 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…
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 several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.

820 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