I'm just wondering is there a way to enter a new line in iTerm 2 without executing the line being typed? I am looking to make use of some relatively long commands to automate some things, but not being able to format things is proving to make long commands hard to read.

Is there any way to enter line breaks or soft returns so that when enter is pressed the whole command will still execute?

  • If you want to automate something, you could write a script.
    – Arc676
    Commented Dec 8, 2015 at 5:06

1 Answer 1


Not sure if I understand correctly. If you put \ at the end and press enter, it is treated as continuation of the line and control goes to next line for you to type more. Only when you press enter on a line that doesn't end in \ is when the entire piece of code gets executed on the shell. So in a way \ could be you soft return.

  • What if the line starts with # (it is an inline comment)? Commented Apr 12, 2018 at 18:19
  • 2
    This is not useful when you're looking to insert new lines in the middle of a previously executed command.
    – damd
    Commented Jan 26, 2021 at 10:59

You must log in to answer this question.

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