Solved

Shell prompt Not displaying properly

Posted on 2004-09-14
10
338 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 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SSL/TLS - openssl troubleshooting 3 77
Centos 7 DNS server not replying to clients 3 90
Krita v3 Linux Mint/Ubuntu 16.04 9 69
Linux Server mapping drive using SSH key 9 43
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

739 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