Nethence Newdoc Olddoc Lab Your IP BBDock  

Warning: those guides are mostly obsolete, please have a look at the new documentation.


KSH configuration
KSH Versions
Look for your KSH version,
Ctrl-V (PDKSH emacs mode)
Esc, Ctrl-V (PDKSH vi mode)
Ctrl-Alt-V (KSH93 emacs mode)
Esc, Ctrl-Alt-V (KSH93 vi mode)
Note. seen versions,
RHEL5: KSH93 (Version AJM 93t+ 2010-02-02)
Slackware: KSH93 (Version M 1993-12-28 s+)
NetBSD: PDKSH (PD KSH v5.2.14 99/07/13.2)
Solaris: KSH88
For HP/UX, BSD and other systems, make sure KSH is enabled,
vi /etc/shells
Start KSH,
Note. "-l" for login shell with PDKSH
Make it the default shell,
#HP/UX & Redhat
#chsh -s /bin/ksh USERNAME
#chpass -s /bin/ksh USERNAME
#vi /etc/passwd
Minimal configuration
cd /etc
mv profile profile.dist
vi profile
vi kshrc
HOSTNAME=`uname -n`
(( `id -u` == 0 )) \
&& PS1='${HOSTNAME%%.*}:${PWD/#$HOME/\~}# ' \
|| PS1='${HOSTNAME%%.*}:${PWD/#$HOME/\~}> '
set -o emacs
alias ll='ls -alF'
alias rm='rm -i'
alias mv='mv -i'
alias cp='cp -i'
Note. the /#$HOME/ substitution works with KSH93 only, remove it, eventually
Note. single quotes around the PS1 variables ! Otherwise the PWD won't be dynamic.
Note. eventhough the ENV variable should work on Solaris (KSH88), it doesn't. Just put kshrc's content inside profile (some lines won't work if another shell gets started).
KSH88 specific
The default Korn Shell configuration on HP/UX has the freacking local dir in the PATH. Overwrite it with the c
Note. "^?" may be written using VI's special character mode (^V), but it also works just like that.
KSH93 specific
Use the provided link above and uncomment the KSH93 part.
Note. this only works with Emacs style
Note. tab "\t" becomes ESC ESC
Note. "^L" clears the screen
Note. "^L" needs to be written with Vi's character mode (insert "^V").
In case of older terminals,
infocmp | grep clear
or check that output against the ascii table,
cput clear | oc -d
man ascii
in example,
0000000 033 [ H 033 [ J
Try it out on the command line,
echo -ne "\E[H\E[J"
Include it inside the kshrc and add a carriage return, as shown in the keybinding example above,
There's also a brute force method which should work everywhere,
keybind $'^L' $'clear\r'
Note. "^L" needs to be written with VI's character mode ("^V").
Unused bindings (works already),
keybind $'\EOA' $'\020' # Up key
keybind $'\EOB' $'\016' # Down key
keybind $'\EOC' $'\006' # Right key
keybind $'\EOD' $'\002' # Left key
keybind $'\EOH' $'\001' # Home key
keybind $'\EOP' $'\004' # Delete key
keybind $'\EOY' $'\005' # End key
Ununsed history feature (works already),
alias __A=$(print -n "\020")
alias __B=$(print -n "\016")
alias __C=$(print -n "\006")
alias __D=$(print -n "\002")
Refs. keyboard trap
PDKSH specific
Use the provided link above and uncomment the PDKSH part.
Note. "^M" should be an enter key made with VI's "^V" mode. But it works anyway !
Note. in VI mode, "set -i viraw" is the default with PDKSH.
PDKSH Home :
PDKSH Manual :
PDKSH Notes :
Default kshrc : (see etc/ksh.kshrc)
OpenBSD kshrc :
Common keybindings
Filename completion,
See if you have an /etc/inputrc file on your system,
less /etc/inputrc
Emacs style
^E  # End of line
^A  # Beginning of line. Use ^Aa inside screen
^U  # Clear line
^H  # Backspace
^B  # Character back
^F  # Character forward
VI style
To use the Shell prompt history, enter into command mode,
and use VI's equivalent for arrow keys,
Note. other usual VI commands work.
From the official FAQ,
Q3.  What is the history of ksh?
A3.  ksh was written by David Korn at Bell Telephone Laboratories.
  David Korn is currently at AT&T Laboratories.
  The first version of ksh was in 1983. It was the first
  shell to have command line editing with both emacs
  and vi style interaction. The 1986 version was the first
  to offer multibyte support. The 1988 version of ksh
  is the version that was adopted by System V Release 4 UNIX
  and was a source document for the IEEE POSIX and ISO
  shell standards. The 1993 version is a major rewrite
  of the 1988 version and focuses more on scripting.
Korn Shell FAQ :
OpenGroup POSIX® 1003.1 FAQ
IEEE Standards :
Graphical Desktop Korn Shell :
Comeau C/C++
Greg Comeau (Comeau C++) claims to have a shell to C++ translator on his website.
Wikipedia Comeau C/C++ :
gilb's EXINIT :
Setting terminal characteristics with stty :
Special Keys :
any file exists in dir ? :
solaris & backups examples : (syncit, root, solaris TCP tweak)
Oreilly :
C shell pushd/popd on steroids as Korn Shell functions :
Sensing locale with HP-UX applications :
Building Locales for HP-UX 11.0 and HP-UX 11i :

(obsolete, see the new doc)