Terminal help

Discussion in 'Mac Basics and Help' started by Tyler23, Dec 9, 2010.

  1. Tyler23 macrumors 603

    Tyler23

    Joined:
    Dec 2, 2010
    Location:
    Atlanta, GA
    #1
    Hey everyone, I have an issue with Terminal..a few months ago I was just running some commands..somehow I deleted everything from terminal, and wasn't able to run any more commands.

    Somehow, I got the functionality back by my address (whatever it's called..dunno the lingo), has changed..

    here's what I see now:

    Last login: Thu Dec 9 18:22:30 on ttys000
    new-host-2:~ tylerclifford$ defaults write com.apple.Safari


    It says new-host-2: now, instead of just saying my name (which is what it did before).

    How did this happen, is it a problem, and how can I get it back to how it used to be?
     
  2. LPZ macrumors 65816

    Joined:
    Jul 11, 2006
    #2
    In Terminal enter the following:

    Code:
    scutil --get HostName; scutil --get LocalHostName; scutil --get ComputerName
    
    and post the output.
     
  3. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #3
    It looks like the prompt was changed. You can change it by adding the following to either the .profile or .bash_profile file in your home directory (may not exist yet and is invisible).
    Code:
    export PS1=":\w \u> "
     
  4. LPZ macrumors 65816

    Joined:
    Jul 11, 2006
    #4
    Thanks. The default is PS1='\h:\W \u\$ ' I suspect this is what the OP had, but he has only noticed the host name now since it has changed.
     
  5. Tyler23 thread starter macrumors 603

    Tyler23

    Joined:
    Dec 2, 2010
    Location:
    Atlanta, GA
    #5
    Before I forget, thanks for helping me with this! It's been bugging me..

    Here's the outup:


    new-host-2:~ tylerclifford$ scutil --get HostName; scutil --get LocalHostName; scutil --get ComputerName

    HostName: not set
    tyler-cliffords-macbook-pro-3
    Tyler Clifford’s MacBook Pro (3)
    new-host-2:~ tylerclifford$
     
  6. LPZ macrumors 65816

    Joined:
    Jul 11, 2006
    #6
    What's the output from

    Code:
    echo $PS1
    in Terminal?
     
  7. Tyler23 thread starter macrumors 603

    Tyler23

    Joined:
    Dec 2, 2010
    Location:
    Atlanta, GA
    #7
    new-host-2:~ tylerclifford$ echo $PS1
    \h:\W \u\$
     
  8. LPZ macrumors 65816

    Joined:
    Jul 11, 2006
    #8
    Strange. What do you get from

    Code:
    hostname
    in Terminal?
     
  9. Tyler23 thread starter macrumors 603

    Tyler23

    Joined:
    Dec 2, 2010
    Location:
    Atlanta, GA
    #9
    new-host-2:~ tylerclifford$ hostname
    new-host-2.home


    I don't really know anything about this, but even I think this is weird..and I have no idea how I did this to the Terminal.
     
  10. LPZ macrumors 65816

    Joined:
    Jul 11, 2006
    #10
    What do you get from

    Code:
    dscacheutil -cachedump -entries host
    in Terminal?
     
  11. Tyler23 thread starter macrumors 603

    Tyler23

    Joined:
    Dec 2, 2010
    Location:
    Atlanta, GA
    #11
    new-host-2:~ tylerclifford$ dscacheutil -cachedump -entries host

    DirectoryService Cache Overview:
    AAAA Queries - Disabled (link-local IPv6 addresses)
    Cache Size - 8

    Entry count by category:
    Group - 3
    Service - 1
    User - 4

    Cache entries (ordered as stored in the cache):

    Category Best Before Last Access Hits Refs TTL Neg DS Node
    ---------- ------------------ ------------------ -------- ------ -------- ----- ---------
     
  12. LPZ macrumors 65816

    Joined:
    Jul 11, 2006
    #12
    Well, let's reset that hostname.

    In Terminal, enter

    Code:
    sudo scutil --set HostName tyler-cliffords-macbook-pro
    You'll need to enter your password when asked. Then quit and restart Terminal.
     
  13. Tyler23 thread starter macrumors 603

    Tyler23

    Joined:
    Dec 2, 2010
    Location:
    Atlanta, GA
    #13
    it's not letting me type anything in? it asked for the password in the output but I'm not able to type anything within Terminal.
     
  14. Tyler23 thread starter macrumors 603

    Tyler23

    Joined:
    Dec 2, 2010
    Location:
    Atlanta, GA
    #14
    well not sure what the problem was but I went to Shell --> New Command, re-entered the command you gave me and was able to type the password (although it displayed nothing as I was typing).

    this is what I see now:

    Last login: Thu Dec 9 20:22:06 on ttys000
    tyler-cliffords-macbook-pro:~ tylerclifford$

    does that seem about right?
     
  15. LPZ macrumors 65816

    Joined:
    Jul 11, 2006
    #15
    That seems fine. You can use

    Code:
    sudo scutil --set HostName tyler-cliffords-macbook-pro
    again should the problem return. (You can also set the hostname to something else just by changing the text after the word HostName in this command.)

    You can also customize the prompt as suggested by angelwatt, so that the hostname doesn't appear at all.
     
  16. Tyler23 thread starter macrumors 603

    Tyler23

    Joined:
    Dec 2, 2010
    Location:
    Atlanta, GA
    #16
    thanks a lot for your help, I feel much better now haha
     

Share This Page