If you moved to AIX from Linux, like I did, the one thing you will miss with KSH is the command recall and auto-complete that BASH offered. Well you needn’t worry because KSH has these capabilities, you just have to spend some time familiarising yourself with the new techniques.
This tutorial will be heavily related the the Vi Tutorial. I suggest if you need more help or explanations with this, please visit that post for further explanation.
When using KSH, you can select the default history editor type. To do this we use the “set -o” command.
$ set -o vi -> use vi as your command history editor
$ set -o emacs -> use emacs as your command history editor
$ set -o gmacs -> use gmacs as your command history editor
This will in turn allow you to use vi to edit the line that you are currently typing. This will help for command history recall and editing and reissuing commands with errors etc.
Once you have issue the “set -o vi” command, you will use basic vi techniques to navigate and edit your history:
<esc> + k -> This will bring up your most recent command, and initiate the history recall session. From now on you will be using vi on your current line
k -> up
j -> down
h -> left
l -> right
x -> delete char
A -> append to line
i -> switch to insert mode
<esc>+’=’ -> This command will give you a list of possible files/directories that exist based on your input. For instance, if you are in a directory with “text.txt, terminal.out, erlog.out” and you issue “$ ls te<esc>+’='”, you will get:
<esc>+\ -> This command will complete the file name as far as it can, similar to file name completion in BASH using <Tab>.
I hope this quick tutorial on command history recall and editing has helped you. Remember you can add “set -o vi” to your profile to ensure it is set every time you log onto the lpar.