sql*plus does not have a command history function under Linux and Unix.
Lately I listened to Tom Kyte at one of his seminars he delivered in September in Zurich. He used a virtual Linux machine and had a command history for his sql*plus obviousely.
He told us that he used a utility called rlwrap for this.
rlwrap is a readline wrapper for shell commands which uses input from the controlling terminal.
It adds a persistent input history for each command and supports user-defined completion.
I simply had to get it!
And I think that this is worth sharing it.
Here is how it works and how you can get it too.
You can download the sources for the rpm for rlwrap from
here. The most recent version I could find is version 0.26.
There you also find a README and the manpage for rlwrap.
After downloading and unpacking the tar.gz I ran as root (#)
and that was it.
Now I could call sqlplus this way:
$ rlwrap sqlplus user/password@sid.
Finally I create an alias
alias sqlp =”rlwrap sqlplus”
(pls see Laurent Schneider’s comment on this post about alias sqlplus!)
Now I can simply call sqlplus as I always have done
and have a commend history with the ↑ and ↓ keys on my keyboard.
This will put an end to the stoneage habits we have all got used to too much!