Oct 13 2009

Command History with Arrow Keys in Ksh

Published by dave at 11:48 am under Aix,linux,Misc,solaris

Arrows aren’t used in ksh as a default. To enable command history like in Bash, add the following lines in the .profile or .kshrc file:

# Switch to Emacs mode
# Only Emacs mode lets you make use of arrow keys
set -o emacs

# Go back in command history (up arrow)
alias __A='^P'
# Go back in command history (down arrow)
alias __B='^N'
# Move right on the command line (right arrow)
alias __C='^F'
# Move left on the command line (left arrow)
alias __D='^B'

 
^P, ^N, etc aren’t one single caracter. Enter Ctrl-V and Ctrl-P to display them in vi.
 
Auto-completion is only available for files, not commands. Press either twice on the escape key, or the tab key on newer systems.
 


No responses yet

Comments RSS

Leave a Reply

Security Code: