created on | January 28, 2022 |
jshell maintains a history that includes all previously entered commands and snippets. This includes failed commands and snippets, as well as overwritten an dropped snippets. without parameter lists all commands and snippets that have been entered in the current session. lists all commands and snippets of all sessions.
reruns the last snippet. runs the snippet with id . Several ids can be provided, separated by space. Ids can also be given as an id range.
reruns the nth previous snippet. Commands are not included in the count.
jshell offers forward and backward incremental search of the history of the current session.
Pressing
Typing the search string at the prompt will display the last recent history entry that contains the search string:
Pressing
I didn’t find the forward incremental search particularly useful, but rather cumbersome to
use. You can try that one out with
The history is stored in the file (see section ‘the jshell configuration file’).
Entries of the history are stored like in the example below: