Results 1 to 9 of 9

Thread: Long name in command line

  1. #1
    Join Date
    Dec 2012
    Beans
    4

    Question Long name in command line

    In my terminal I am "thomas@thomas-Gazelle-Professional:~/

    I just want it to be home/

    How do I change it?

  2. #2
    Join Date
    Aug 2008
    Location
    WA
    Beans
    2,186
    Distro
    Ubuntu

  3. #3
    Join Date
    Dec 2012
    Beans
    4

    Re: Long name in command line

    Quote Originally Posted by iponeverything View Post
    Thank you. It didn't make a difference in my case, because I guess the link to "debian_chroot" is what controls the long bash name. I'll try to figure out how to edit that file.

  4. #4
    Join Date
    Dec 2012
    Beans
    4

    Re: Long name in command line

    This isn't going to be as easy as I thought. Somehow the "@thomas-Gazelle-Professional" was added to my user id. I don't know where to make that change!

  5. #5
    Join Date
    May 2012
    Location
    Preston, Lancs, UK
    Beans
    75
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: Long name in command line

    You need to remove \h from the prompt. Remember that \u is your username \h is your hostname and \w is the current working directory.

  6. #6
    Join Date
    Sep 2006
    Beans
    8,627
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Long name in command line

    To see what all those shortcuts mean, check the manual page for bash and scroll down to "PROMPTING"

    Code:
    man bash
    Knowing what they do will help you edit the PS1 lines.

  7. #7
    Join Date
    Dec 2012
    Beans
    4

    Re: Long name in command line

    Quote Originally Posted by Lars Noodén View Post
    To see what all those shortcuts mean, check the manual page for bash and scroll down to "PROMPTING"

    Code:
    man bash
    Knowing what they do will help you edit the PS1 lines.

    Thanks, but that didn't help. I think I need to actually find my username and change it. Here's the appropriate line from my bashrc:

    else
    #PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
    PS1="[ ${debian_chroot:+($debian_chroot)} \u: \w ]\\$ "
    PS2="> "

    and here is my command line:

    thomas@thomas-Gazelle-Professional:~$

    I want it to be :

    thomas:~$

  8. #8
    Join Date
    Sep 2006
    Beans
    8,627
    Distro
    Ubuntu 14.04 Trusty Tahr

    leave out the host name

    Wouldn't that be something like this? It leaves out the host name.

    Code:
    PS1='\u: \w \$ '
    If you want to make the changes permanent then you'll have to edit .bashrc. Be sure to make a backup copy first, before you start editing.

  9. #9
    Join Date
    Oct 2007
    Location
    Aurora, CO
    Beans
    2,564
    Distro
    Ubuntu

    Re: leave out the host name

    Specifically, you can make that change permanent by running:

    Code:
    PS1='\u: \w \$ '
    cp ~/.bashrc ./bash-bak
    echo "PS1='\u: \w \$ '" | tee -a ~/.bashrc
    What you're trying to eliminate is the Hostname, which needs to be set to something. Changing the prompt is a much better way to do it.
    Ian Santopietro - System76 Technical Support.
    Open a Support Ticket!
    Ask a Sales Question!

Bookmarks

Posting Permissions

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