9

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.

Thanks!

Mr.Wizard
  • 271,378
  • 34
  • 587
  • 1,371
Tim
  • 317
  • 3
  • 8

2 Answers2

8

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.

  • 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. –  Mar 15 '12 at 15:27
5

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.

Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263
  • 2
    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 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. – Frames Catherine White Nov 10 '12 at 06:23