Automatic Korn Shell aliases


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'
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


Ruben Schade is a technical writer and IaaS engineer in Sydney, Australia who refers to himself in the third person in bios. Wait, not BIOS… my brain should be EFI by now.

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

You can leave me a comment by contacting me, and I might publish your thoughts. Please read the FAQs first though.

If you found this post helpful or entertaining, you can shout me a coffee or buy some silly merch. Thanks!