1

Whenever I start a new session with iTerm, it sends sudo su and PS1="[web stage | \d \t \w]:" to the terminal window. I'm think this is something that someone set up for me in iTerm a long time ago. It's very irritating and I want it to stop. :-)

I looked all over the settings/prefs in iTerm and can't find any sign of what could be doing it, nor the string sudo su or PS1= anywhere. (And yes, Profiles > Command > Send Text at Start is empty-- that was my first thought but nothing there.)

I am 99% sure this is something from iTerm and not bash because when I launch the Terminal app, I don't get this behavior.

Where would this be stored and how can I stop it?

-- EDIT to add details:

It's not "Send Text at Start."

This is happening only in iTerm, not Terminal. Here's my iTerm Preferences/Profiles screen:

enter image description here

And, here's my ~/.bash_profile file:

export EC2_HOME=~/.ec2
export PATH=$PATH:/bin:/usr/bin:EC2_HOME/bin:/usr/local/bin
export EC2_PRIVATE_KEY=pk-afv_db1.pem
export EC2_CERT=cert-afv_db1.pem

And my entire ~/.bashrc file:

alias myip=ifconfig | grep 'inet ' | grep -v 127.0.0.1 |
   cut -d\   -f2
export EDITOR="/usr/local/bin/mate -w"
export PATH=$PATH:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
  • 1
    Is it happening in both iTerm and Terminal or just iTerm? Also, can you post the contents of your ~./bash_profile and/or ~/.bashrc – Allan Oct 27 '16 at 15:02
  • @Allan thank you, edited question to add details you requested. – Eric Nov 1 '16 at 17:23
  • 1
    Does your iTerm configuration have any Triggers defined? You can find Triggers in the Advanced tab of the Profiles part of Preferences (visible to the far right in your screen shot). – Eirik Fuller Nov 1 '16 at 18:40
  • @EirikFuller - Ahh good idea, but that's not it. The "Triggers" screen is totally empty. – Eric Nov 1 '16 at 19:44
  • What about /etc/profile? Can you post the contents of that file? – Allan Nov 3 '16 at 9:50
1

Have you tried greping your home directory?

sudo grep -R 'PS1="' ~/

Or, if you're really getting frustrated-

sudo grep -R 'PS1="' /

Maybe redirect stdout of those bad boys to files so you don't have to run them over and over to work with the results.

1

Solved the problem. It's sort of an interface issue in iTerm, though it's a bit of an edge case.

It turns out there was stuff in the "send text at start" field. The first character in there was a newline (\n), so in the interface screen shot, the field looked empty. But when I clicked in there and pressed the down arrow, "sudo su" showed up (the first line of what was being sent).

Props to the developer, George Nachman, who pushed me in the right direction. I turned on the debugging log and found this:

 "Initial Text" = "\nsudo su\nPS1=\"[web stage | \\d \\t \\w]:\"\n"

So that was the clue I needed.

Thanks to everyone who puzzled over this with me...

  • happend to me too with other commands. The interface is weird, as it can process a newline but does not look like you can scroll it down, but you can with the arrow keys to allow multiple lines of input. – BlkPengu May 9 at 9:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .