Automatic Korn Shell aliases

Software

I’ve mentioned a few times that I’m trialling the Korn Shell as my daily driver. I used tcsh for many years due to my preference for FreeBSD, but I prefer writing quick one-liners in Bourne.

Today I learned the Public Domain Korn Shell (pdksh) defines the following aliases automatically, as per the NetBSD ksh(1) manpage. NetBSD is where I first used the Korn Shell, and it’s bundled in its base system.

autoload='typeset -fu'
functions='typeset -f'
hash='alias -t'
history='fc -l'
integer='typeset -i'
local='typeset'
login='exec login'
nohup='nohup '
r='fc -e -'
stop='kill -STOP'
suspend='kill -STOP $$'
type='whence -v'

Sure enough:

$ type
==> Usage: whence [-afpqv] name  ...

I’ve seen manpages for other Korn Shell variants list more options, but I’m going to treat this list as canonical. It’d be a fun exercise to compare and contrast.

Author bio and support

Me!

Ruben Schade is a technical writer and infrastructure architect in Sydney, Australia who refers to himself in the third person. Hi!

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite bespoke cloud infrastructure provider.

If you found this post helpful or entertaining, you can shout me a coffee or send a comment. Thanks ☺️.