8

How can I enter multiple lines in a terminal ? I would like to do the same thing as when I do shift + enter in chrome.

Lev
  • 13,856
  • 14
  • 52
  • 84
  • Apparently shift+enter in the Chrome console allows you to embed a newline in a command without submitting it for evaluation just yet. In many situations the shell already knows you are in a context where the command line isn't finished, such as when you are in a string or in a control block such as `if`, `while`, or `for` without a corresponding `fi` or `done` – tripleee Jan 31 '18 at 10:23
  • try Ctrl+Shift+Enter – mcbill Apr 10 '19 at 12:14
  • Only `Esc`+`Return` works for me. – Noumenon Jan 19 '23 at 23:28

1 Answers1

19

End your line with a backslash (\), hit Enter, and continue typing on the next line.

Keep in mind that if you need spaces between the parts of your command, you need to enter them explicitly, e.g.:

ls \
-la
Robby Cornelissen
  • 91,784
  • 22
  • 134
  • 156