This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

Using a Text-Based Interface

The standard front end interface, as discussed in "Using a Notebook Interface", is appropriate for most users' purposes. In some cases, however, you may not need to use the notebook front end, and you may want instead to interact more directly with the Mathematica kernel. You can do this by using a text-based interface, in which text you type on the keyboard goes straight to the kernel.
It is important to note that while the text-based interface provides access to most of the capabilities of the Mathematica kernel, the graphics functionality and dynamic interactivity of the Mathematica front end are not available.
To start Mathematica with a text-based interface, you typically type the command math at an operating system prompt. On some systems, you may also be able to start Mathematica with a text-based interface by double-clicking a Mathematica kernel icon.
maththe operating system command to start Mathematica
text ending with Enterinput for Mathematica
Ctrl+D or Quitexiting Mathematica

Running Mathematica with a text-based interface.

A dialog with Mathematica using a text-based interface.
In[1]:= 2^100

Out[1]= 1267650600228229401496703205376

In[2]:= Integrate[1/(x^3 - 1), x]

1 + 2 x
ArcTan[-------] 2
Sqrt[3] Log[-1 + x] Log[1 + x + x ]
Out[2]= -(---------------) + ----------- - ---------------
Sqrt[3] 3 6
At each stage, Mathematica prints a prompt of the form In[n]:= to tell you that it is ready to receive input. You can then type your input, ending with Enter or Return.
When you have entered your input, Mathematica will process it and generate a result. If it prints the result out, it will label it with Out[n]=.
In Mathematica documentation, "dialogs" with Mathematica are often shown in the following way:
The computer prints In[1]:=. You just type in . The line that starts with Out[1]= is the result from Mathematica.
Click for copyable input
Note that you do not explicitly type the In[n]:= prompt; only type the text that follows this prompt.
Most of the actual dialogs given in the Mathematica tutorials show output in the form you get with a notebook interface to Mathematica; output with a text-based interface looks similar, but lacks such features as special characters and font size changes.
If your input is short, then you can give it on a single line. If your input is longer, you can give it on several lines. Mathematica will automatically continue reading successive lines until it has received a complete expression. Thus, for example, if you type an opening parenthesis on one line, Mathematica will go on reading successive lines of input until it sees the corresponding closing parenthesis. Note that if you enter a completely blank line, Mathematica will throw away the lines you have typed so far, and issue a new input prompt.
%n or Out[n]the value of the n^(th) output
In[n]the n^(th) input, for reevaluation

Retrieving and reevaluating previous input and output.

With a text-based interface, each line of Mathematica input and output appears sequentially. Often your computer system will allow you to scroll backwards to review previous work, and to cut-and-paste previous lines of input.
But whatever kind of computer system you have, you can always use Mathematica to retrieve or reevaluate previous input and output. In general, reevaluating a particular piece of input or output may give you a different result than when you evaluated it in the first place. The reason is that in between you may have reset the values of variables that are used in that piece of input or output. If you ask for Out[n], then Mathematica will give you the final form of your n^(th) output. On the other hand, if you ask for In[n], then Mathematica will take the n^(th) input you gave, and reevaluate it using whatever current assignments you have given for variables.
To exit Mathematica, type Quit at an input prompt. You may also exit Mathematica by typing Ctrl+D or Ctrl+Z, depending on your computer system.