Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wonder what is the shortcut key for traverse command history (i.e. retrieve last, last last, ..., commands) in a Mathematica session in a terminal?

If I hit the up/down arrow or pageup/pagedown, it will only show some incomprehensible codings of the keys.

My OS is Ubuntu.


share|improve this question

I use the command line kernel quite often and use it in conjunction with rlwrap. This allows for history, command line completion, and command line editing. A convenient addition - all one would desire.

share|improve this answer
very nice! Do you happen to know how to get EditIn working again? In 5.2 it still worked. – Rolf Mertig Mar 15 '12 at 14:59
@RolfMertig, no, not really, I'd have to dig in really deep and find that. See if rlwrap helps you if not, I'll try to find out what happened to EditIn happened. – user21 Mar 15 '12 at 15:27

Mathematica does not use readline on Linux so it's simply not possible to do this. You might Google for readline based command line interfaces to Mathematica.

That said, I strongly recommend not to use the command line interface unless you simply have no means of using the front end (e.g. working on a remote server through a slow network that makes X forwarding inconvenient). Despite what you might read on Unix forums, command lines are not always more convenient than a well designed graphical interface. It is impossible to be nearly as productive with any sort of command line as a proper notebook interface when using Mathematica or similar systems. And note that a notebook interface is an extension of the command line, with a superset of a command line's functionality.

share|improve this answer
I disagree. For certain problemd the command line very much superior (e.g. faster restart, no trouble with the Frontend). – Rolf Mertig Mar 15 '12 at 14:41
(strange 5 minute edit rule for comments...): @Szabalocs: Also Wolfram Workbench (Eclipse) is just the command line, resurrected: no problem with multiple undo, history, CVS, svn, Mercurial, git, all there. How to do this in the standard FrontEnd? I use all UI's to Mathematica: FrontEnd, command line, Wolfram Workbench. Also: until Mathematica 3.0 most programmers did not use the FrontEnd. – Rolf Mertig Mar 15 '12 at 14:47
Does the front end have a way to scroll through command history? I know about Ctrl+L, but that's not the same as the up key in the command-line. – Andrew MacFie Mar 15 '12 at 16:00
@AndrewMacFie No, but at least to display them is just a one-liner FlipView@Reverse@DownValues@In – Rolf Mertig Mar 15 '12 at 23:47
JMath was made for Mathematica 5.2. It seems no trivial to get it to compile. – Oxinabox Nov 10 '12 at 6:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.