Experimenting with mksh in DSL

I’ve been experimenting with shells (which will be the subject of my next productivity tip) while playing with DSL and dslcore. I’m looking for something that’s still responsive and “snappy” while providing more features than ash. Nothing against ash. It’s functional. Minimally functional.

If dslcore has a shell with a little more flexibility and power, maybe the project can drop lua and the “GPL plus strings” BS with a certain developer. That would make it even smaller.

I’d installed bash-3.2 on my DSL hard drive install Friday. I compiled it with nearly every option. The result is a large binary. And this is stripped!

-rwxr-xr-x    1 root     root       686912 Jul  4 18:55 /bin/bash

I also made a pretty prompt showing date and time, which is useful since I see shell prompts more often than clocks, etc., in ratpoison (“ctrl-[escape key] a” shows the time). This was a little less slow than zsh, which is my favorite shell except its slower speed — all that function and dazzle comes with a price. I wanted something lighter and faster and, if it can be used in dslcore, without sacrificing too much power.

I also run OpenBSD. Its default shell is ksh. The Korn Shell is a very nice shell. It’s feature-packed yet unbloated. The version in OpenBSD is much improved over versions I’ve used in the past. I installed zsh for a day or two on my server but took it off because it was too slow (MMX 200mhz/64MB RAM) and overkill for the few things I need.

I thought of trying ksh in DSL so I decided to look around at Korn Shell offspring. One of the derivatives of the Korn Shell I found was mksh from MirOS (which is based on OpenBSD and NetBSD). I played around with the build script to see how small it could be made. Even after stripping it was in the 200kb range. Suitable and comparable to the default (older) bash in DSL. The license terms for mksh are very simple and not as cumbersome as the GPL.

I started it from my existing bash shell. It was noticeably faster with the first few things I tried. I decided to check “resource drain” with it set as my default. I didn’t check the original DSL bash so this isn’t a comparison — you can check your default and weigh these results. It’s also not a look at the difference from boot; I have a few hours uptime. As a result, I also had more processes running than a default environment at boot.

These two shots were taken at the same time. The top part is from htop, the bottom is ps aux (with PIDs, etc., removed).

It’s very nice to run a kind of complex one-liner and get an immediate result — something I miss when using zsh and bash on older hardware. I’m going to play around with this a little more later today if I get a chance. I should get around to posting my productivity tip on shells and shell use later this week or next weekend — and more OpenBSD content also coming on my other blog.


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: