Fastest Linux Shell

There are many of you out there always looking for another way to tweak your Linux computer to make it even faster. Well this is just one of my tips that will help speed up your overall system slightly. Most of you out there are probably using bash as your Linux shell. This is fine, but there are other shells available that are faster, smaller, and use less system resources.

Everytime you login to your Linux system, open a terminal, execute a script, etc. you are opening up another Linux shell. Most of you Linux users are thinking it’s just a Linux shell, it doesn’t take up much resources, that’s true, but just think if you had 10 shells running. The system memory usage would increase a bit. Plus for those of you that don’t have faster computer hardware with tons of resources, we want to conserve as much RAM as possible.

So what can we do about all these Linux shells running eating up our system resources? We can install a lightweight shell and set it to be your default Linux shell. Let’s install dash which is a replacement of ash (Almquist Shell) which was a BSD-licensed replacement for the Bourne Shell that was used in low resource systems.

Depending on what Linux distro you are running, you may need to install dash slightly differently. First lets install dash.

  • Gentoo: emerge --sync && emerge dash
  • Debain: apt-get update && apt-get install dash
  • Fedora: yum install dash

Now that you have dash installed, we want to make dash your default Linux shell. To do this first we want to open a terminal. Type chsh and hit enter, now you should be asked what shell you want to use. Type /bin/dash and hit enter. Any username you want to use the dash shell, repeat the chsh command and change your shell to /bin/dash.

Now we want to change the symlink of /bin/sh to point to /bin/dash instead of /bin/bash. To do this we must first delete the current symlink /bin/sh. In your terminal, type rm -f /bin/sh now we need to create a new symlink to /bin/dash. To do this in your terminal type ln -s /bin/dash /bin/sh and now you are done. Logout and log back in and all of your terminals and shells will be using dash.

NOTE: dash is a very lightweight Linux shell and does not have many features that bash and some other Linux shells have. dash does not support tab complete, so you can’t type cd /us(TAB)sr(TAB)lin(TAB) and be taken to /usr/src/linux. dash does not support history either, so if you were just doing a bunch of long commands in a shell and didn’t want to retype them, just hit up a couple times and then hit enter, well you can’t with dash, but you will notice your scripts running faster, terminals opening faster, less ram being used, etc.

I hope this Linux speed tweak has helped you tweak your Linux computer to make it even more faster! For more Linux tutorials and speed tweaks continue reading through Beginner Linux Tutorial!

Comment Linux tutorial or Leave a Trackback

7 Comments

  1. george
    Posted June 13, 2011 at 12:43 am | Linux tutorial comment

    WHAT ?? if this is for beginners, have no idea what your talking about in fast lenux shell

  2. Ryan
    Posted September 19, 2011 at 4:54 pm | Linux tutorial comment

    I’m stuck at “open your favorite text editor and edit /etc/passwd. Any username you want to use the dash shell, change /bin/bash to /bin/dash and save the file.” could you please give an example? Thanks

  3. Posted September 21, 2011 at 11:16 pm | Linux tutorial comment

    Ryan,
    You can open a terminal and type sudo nano -w /etc/passwd which will open the file for editing.
    A line in my /etc/passwd is:
    brandon:x:1000:1000:Brandon,,,:/home/brandon:/bin/bash
    So I would change the /bin/bash to /bin/dash or even /bin/sh since /bin/sh will be a symlink to /bin/dash. So my line will now look like this:
    brandon:x:1000:1000:Brandon,,,:/home/brandon:/bin/dash
    or
    brandon:x:1000:1000:Brandon,,,:/home/brandon:/bin/sh

  4. Fred
    Posted October 23, 2011 at 9:15 pm | Linux tutorial comment

    That’s stupid. I bet you’re an Ubuntu user.

    It can be useful to write scripts for dash, because it light (for example scripts run in an initrd, init scripts, etc.).

    But, unless you’re on some kind of hardware of limited capability (e.g., an embedded, or handheld device), making dash your default shell is silly. You’re just switching to a less-capable shell. Bash, written by GNU, and the Linux default, is powerful, featureful, and plenty fast. A default shell is the one you use interactively. An interactive shell spends 99% of it’s time waiting on the user anyway.

    If you really need something fast, then you should be writing your script in python or perl. If you need more speed, then you should be writing it in C.

  5. Posted October 23, 2011 at 11:15 pm | Linux tutorial comment

    Fred,
    Not sure what using Ubuntu has to do with anything, but no I don’t use Ubuntu. I use Gentoo, Fedora, Debian, and Slackware. I have tried Ubuntu before though. I think it was some mobile version for support for GMA500 video card on my Viliv N5.

    As far as speeding up your computer this will speed your computer up slightly, I didn’t say it will turn your computer into a power house. Most systems that are slow are caused by hardware limitations, ram, whatever. Doing this will save some RAM.

  6. Patrick
    Posted February 20, 2012 at 9:26 pm | Linux tutorial comment

    Editor the /etc/passwd file to change the shell? Before anyone edits their passwd file take a look at the chsh command and if really have to edit your passwd or shadow file look at vipw.

  7. Posted February 21, 2012 at 6:45 pm | Linux tutorial comment

    Patrick,
    Great thinking, maybe I should edit tutorial and have people use chsh command instead.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*