Command line
The input file specification indicates the file to be formatted; TeX uses .tex as a default file extension. If you omit the input file entirely, TeX accepts input from the terminal. You can also specify arbitrary LaTeX input by starting with a backslash. For example, this processes foo.tex without pausing after every error:

latex '\nonstopmode\input foo.tex'

With many, but not all, implementations, command-line options can also be specified in the usual Unix way, starting with ‘-’ or ‘--’. For a list of those options, try ‘latex --help’.
If LaTeX stops in the middle of the document and gives you a ‘*’ prompt, it is waiting for input. You can type \stop (and return) and it will prematurely end the document.
See TeX engines, for other system commands invoking LaTeX.