?
Solved

Shell prompt Not displaying properly

Posted on 2004-09-14
10
Medium Priority
?
343 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
Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

 
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

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

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

You ever wonder how to backup Linux system files just like Windows System Restore?  Well you can use Timeshift in Linux to perform those similar action.  This tutorial will show you how to backup your system files and keep regular intervals. Note…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
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.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month15 days, 17 hours left to enroll

741 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