Heike's code produces a graphics output. So if you run it inside a raw kernel (which is what the math command does on linux), it won't display any graphics. Instead you'll see something like --Graphics-- on your screen. To actually display the output, you'll need to load the JavaGraphics package as <<JavaGraphics` before the plot command (this needs to be done only once per session).
JensJens has more on running Mathematica without a front-end. Brett Champion also notes the following:
When using
JavaGraphics`, graphics are rendered by a child front end and converted to a bitmap format. So most new features of graphics are supported. The exception is that if there are interactive aspects to the graphic (tooltips, mouse-overs,Dynamics), they will effectively be ignored. Visualization functions sometimes have problems since in order for them to work correctly, they have to handleShowandDisplayFunctionjust right. If you do run across problems with a visualization function when usingJavaGraphics`, please file it as a bug.
As for the rest of the questions, I'll refer you to the official documentation that Sjoerd shared, as there is no need to duplicate information.