I need help with Terminal

Discussion in 'Mac Basics and Help' started by Lshadow, Sep 11, 2016.

  1. Lshadow macrumors newbie

    Joined:
    Sep 11, 2016
    #1
    i typed in a command to help run something and now when ever i open terminal it says hhahahaahahahahahah shadow and wont let me run any commands
     
  2. NoBoMac macrumors 6502a

    Joined:
    Jul 1, 2014
    #2
    Not much to go on, so, let's start with: what command did you run?
     
  3. Weaselboy Moderator

    Weaselboy

    Staff Member

    Joined:
    Jan 23, 2005
    Location:
    California
    #3
    Open another tab in Terminal and type in history and tell us what the last command was from the list.
     
  4. Lshadow thread starter macrumors newbie

    Joined:
    Sep 11, 2016
    #4
    I did it doesn't say the command it had ruby -rand a bunch of gibberish
     
  5. Lshadow thread starter macrumors newbie

    Joined:
    Sep 11, 2016
  6. Weaselboy Moderator

    Weaselboy

    Staff Member

    Joined:
    Jan 23, 2005
    Location:
    California
    #6
    Odd... that is to install Homebrew. I assume that is what you were trying to do?

    Even is was stuck, it should terminate when you quit Terminal.

    Where exactly are you seeing this hah hah text? Can you post a screenshot.
     
  7. Lshadow thread starter macrumors newbie

    Joined:
    Sep 11, 2016
    #7
    yes i was trying to install pygame and that was one of the commands i saw to install it
     

    Attached Files:

  8. Weaselboy Moderator

    Weaselboy

    Staff Member

    Joined:
    Jan 23, 2005
    Location:
    California
    #8
    Ahh... I see. Looks like your Mac's hostname got changed. Run this to change it to what you want. Just substitute whatever you want for "name-you-want" there. Then restart Terminal.

    Code:
    sudo scutil --set HostName name-you-want
     
  9. Lshadow thread starter macrumors newbie

    Joined:
    Sep 11, 2016
    #9
    i tried that but it says sudo command not found did something mess up in my sudoers file?
     
  10. Weaselboy Moderator

    Weaselboy

    Staff Member

    Joined:
    Jan 23, 2005
    Location:
    California
    #10
    Try is like this without sudo.

    Code:
    scutil --set HostName new-name
     
  11. Lshadow thread starter macrumors newbie

    Joined:
    Sep 11, 2016
    #11
    ye idek know
    -bash: scutil: command not found
     
  12. Weaselboy Moderator

    Weaselboy

    Staff Member

    Joined:
    Jan 23, 2005
    Location:
    California
    #12
    What do you get is you just type on scutil by itself just to see if the command binary is there at all?
     
  13. chown33, Sep 18, 2016
    Last edited: Sep 18, 2016

    chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #13
    Try this, and post the complete output:
    Code:
    echo "$PATH" " PS1: $PS1"
    It's best to copy and paste that line into a Terminal window, rather than typing it in manually.
     
  14. Weaselboy Moderator

    Weaselboy

    Staff Member

    Joined:
    Jan 23, 2005
    Location:
    California
    #14
    Can you educate me a bit and explain what that command would do? Thanks :)
     
  15. chown33, Sep 18, 2016
    Last edited: Sep 18, 2016

    chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #15
    First, PATH is a shell variable. It contains a list of directories to look in for commands.

    Second, 'echo' is a bash builtin command, i.e. it doesn't have to exist in any directory. So the 'echo $PATH' means "show the list of directories where bash is looking for commands".

    All the earlier posted error messages indicate that bash is unable to find the command that was entered. Example message:
    -bash: scutil: command not found​

    Note the message is from bash (the '-bash:' part), and bash is telling you the command isn't found. It's not that 'scutil' is running and failing, it's that bash can't find an 'scutil' to run. The simplest explanation for this is that PATH is empty or contains a list of unusable directories.

    The $PATH is quoted because if it contains oddball stuff, I don't want it to be interpreted.


    The next part shows PS1, which is bash's prompt string 1. I put in a literal 'PS1:' in the 2nd quoted string, to separate it from the $PATH.

    PS1 is a special string, which by default contains meta characters that will display the hostname, username, etc. However, PS1 can also contain literal characters, which are simply emitted as the prompt. For example, try this sequence of commands in a Terminal window:
    Code:
    save_PS1="$PS1"
    PS1="mwa-ha-ha \\u \$"
    The first line saves the current value of PS1. The 2nd line sets PS1 to a different prompt. You'll see what happens (nothing horrible, I promise).

    You can restore the original PS1 with this command:
    Code:
    PS1="$save_PS1"
    What I suspect has happened is that whatever has set PATH to some useless value has also set PS1 to a string containing the literal text "hhahahaahahahahahah". The "shadow" part of the prompt might be a literal, or it could be the username, considering the MR id this user signed up as.

    So by asking to see the value of PS1, I'm trying to see if the "hhahahaahahahahahah" is in PS1, or whether the hostname might have actually been changed.


    I suspect the underlying cause of all this mayhem is that one of the bash profile files in the user's home dir is damaged or corrupted, possibly intentionally by whatever command was actually run.

    Looking at bash profiles is where I'll go next, once I find out what PATH is (and correct it), and what PS1 is (and correct it).
     
  16. Weaselboy Moderator

    Weaselboy

    Staff Member

    Joined:
    Jan 23, 2005
    Location:
    California
    #16
    Thank you for the thorough explanation. I appreciate it and I learned a lot.
     
  17. Lshadow thread starter macrumors newbie

    Joined:
    Sep 11, 2016
    #17
    this is the output of that command: shadow is the account name

    ’/usr/local/bin:?? PS1: \h:\W \u\$
     
  18. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #18
    The PATH variable is completely garbled and useless. The PS1 variable seems ok.


    I'm going to post only one step at a time.

    If there's an error message of any kind, stop, then copy and paste the complete text from the Terminal window into a post. You can click and drag to select text in the Terminal window.

    Accuracy is important. Read through the instructions. If you have a question about what to do, ask it here before doing anything.

    Step 1
    Copy and paste this exact command into a Terminal window:
    Code:
    PATH="/usr/bin:/bin:/usr/sbin:/sbin"
    In the same window, copy and paste this exact command:
    Code:
    ls -ld ~/.bash* ~/.*profile*
    Then copy and paste the complete output into a post here.

    If things are working correctly, the 2nd command above may print a message about something not found. Copy and paste the complete output and post it here.


    I'll give Step 2 after I see the results of Step 1.
     
  19. Lshadow thread starter macrumors newbie

    Joined:
    Sep 11, 2016
    #19
    hahahahahahaa:~ Shadow$ PATH="/usr/bin:/bin:/usr/sbin:/sbin"

    hahahahahahaa:~ Shadow$ ls -ld ~/.bash* ~/.*profile*

    -rw------- 1 Shadow staff 11894 10 Sep 15:40 /Users/anthony/.bash_history

    -rw-r--r-- 1 Shadow staff 200 10 Sep 16:36 /Users/anthony/.bash_profile

    -rw-r--r-- 1 Shadow staff 200 10 Sep 16:36 /Users/anthony/.bash_profile

    drwxr-xr-x 100 Shadow staff 3400 20 Sep 07:54 /Users/anthony/.bash_sessions

    hahahahahahaa:~ Shadow$

    it says this{anthony = real name}
     
  20. KALLT macrumors 601

    Joined:
    Sep 23, 2008
    #20
    Try this and close the window afterwards.
    Code:
    /bin/mv ~/.bash_profile ~/.bash_profile~

    Then try again:
    Code:
    echo "$PATH"
     
  21. Lshadow thread starter macrumors newbie

    Joined:
    Sep 11, 2016
    #21
    ill try it later when i finish the one with chown33
     
  22. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #22
    Go ahead and do what KALLT suggested.

    It's very similar to what I was going to post for Step 2.
     
  23. Lshadow thread starter macrumors newbie

    Joined:
    Sep 11, 2016
    #23
    ok this is the outcome
    hahahahahahaa:~ Shadow$ /bin/mv ~/.bash_profile ~/.bash_profile~

    hahahahahahaa:~ Shadow$

    hahahahahahaa:~ Shadow$ Then try again:

    -bash: Then: command not found

    hahahahahahaa:~ Shadow$ Code:

    -bash: Code:: command not found

    hahahahahahaa:~ Shadow$ echo "$PATH"

    ’/usr/local/bin:??

    hahahahahahaa:~ Shadow$
     
  24. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #24
    The "Then try again" isn't commands for Terminal.
    It also looks like you didn't close the Terminal window.

    Please do the following:

    1. Close all Terminal windows.
    2. Open a new Terminal window.
    3. Paste the following into the new Terminal window:
    Code:
    echo "$PATH"
    4. Copy and paste the complete output into a post here.
     
  25. Lshadow thread starter macrumors newbie

    Joined:
    Sep 11, 2016
    #25
    this is the output
    /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
     

Share This Page