Find the answer to your Linux question:
Results 1 to 7 of 7
How would I go about getting my <username@hostname> to be displayed on the command line in rxvt or xterm? Current is displays: bash-3.00$ Any information is much appreciated, ~morawski...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2005
    Posts
    12

    Displaying Hostname in rxvt/term


    How would I go about getting my <username@hostname> to be displayed on the command line in rxvt or xterm? Current is displays:

    bash-3.00$

    Any information is much appreciated,
    ~morawski

  2. #2
    Linux Engineer
    Join Date
    Apr 2005
    Location
    Buenos Aires, Argentina
    Posts
    908
    Code:
    export PS1='\u@\h&#58;\w\$ '
    Type that in a terminal. If it does work, add it to your ~/.bash_profile, it should work.
    serzsite.com.ar
    "All the drugs in this world won\'t save you from yourself"

  3. #3
    Just Joined!
    Join Date
    May 2005
    Posts
    12
    Worked like a charm, thanks serz

    But uh..this brought something to my attention..I don't have a ~/.bash_profile. or a ~/.profile ..

    Why would this be and how can I solve that?

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Engineer
    Join Date
    Apr 2005
    Location
    Buenos Aires, Argentina
    Posts
    908
    Then create it. The following command create and add what you need to your ~/.bash_profile.
    Code:
    echo "export PS1='\u@\h&#58;\w\$ '" > ~/.bash_profile
    serzsite.com.ar
    "All the drugs in this world won\'t save you from yourself"

  6. #5
    Just Joined!
    Join Date
    May 2005
    Posts
    12
    It doesn't seem to work..nothing changed after I rebooted.

    Here are the contents of my .bash_profile:
    Code:
    export PS1='\u@\h&#58;\w\$ '
    set -o vi
    Do I need a shell header? (such as: #! /bin/bash)

    ~morawski

  7. #6
    Linux Engineer
    Join Date
    Apr 2005
    Location
    Buenos Aires, Argentina
    Posts
    908
    Those shells (rxvt/xterm) must not be reading ~/.bash_profile every time you open them.
    Code:
    cp ~/.bash_profile ~/.bashrc
    Try that.
    serzsite.com.ar
    "All the drugs in this world won\'t save you from yourself"

  8. #7
    Just Joined!
    Join Date
    May 2005
    Posts
    12
    Quote Originally Posted by serz
    Those shells (rxvt/xterm) must not be reading ~/.bash_profile every time you open them.
    Code:
    cp ~/.bash_profile ~/.bashrc
    Try that.
    You're a beautiful person, serz.

    Thanks
    ~morawski

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •