A while a go I looked at Bash replacements for interactive shells. Unfortunately for me, I am just getting too used to having Bash on the command line and can’t get myself used to other shells.
However, interactive shell is one thing, and scripting shell is another. If your scripts are compatible with the original bourne shell, then you should try dash instead of that big fat Bash! This morning I just discovered one of my Debian 5 VPS is not having /bin/sh
linked to dash by default, so I “fixed” the problem, and here is the memory consumption result:
Before
$ ps aux | grep /bin/sh root 7473 0.0 0.1 2416 1156 ? S Feb12 0:00 /bin/sh /usr/bin/mysqld_safe
After
$ ps aux | grep /bin/sh root 15528 0.0 0.0 1632 520 ? S 10:03 0:00 /bin/sh /usr/bin/mysqld_safe
Yup. 1/2 MB reclaimed. Just make sure your /bin/sh
is linked to dash
. If it’s not already the case, then for Debian/Ubuntu based systems
# apt-get install dash # dpkg-reconfigure dash
You also need to make sure all your scripts are compatible with sh/dash (which they ought to anyway).
Related Posts:
- 5 Reasons Why You Want a Low End Box - May 26, 2021
- Dead Pool January 2012 - February 2, 2012
- exit(0); - January 19, 2012
I know this is almost four years late, but take a look at
mksh
as well. It’s a Debian Squeeze replacement ofpdksh
and it includes a statically-linked binary calledmksh-static
(/bin/mksh-static
) that is trimmed down a bit. It can be used both as an interactive and non-interactive shell and takes just ~200 KB memory on my VPS.I also set
mksh-static
instead ofbash
for my SSH session and that saved me whole 2 megabytes.