Pretty BASH Configuration with IBM i Helpers

    Making BASH Your Default Shell

    There are (at least) a couple of different ways to achieve having BASH on login.

    sshd_config – Globally (not recommended)

    This will make it so anyone that SSHs in will have BASH at login. More information can be found here

    Edit sshd_config (usually found at /QOpenSys/QIBM/UserData/SC1/OpenSSH/etc/sshd_config) to have the following:

    .profile – Locally (recommended)

    This is recommended as it will only change BASH settings on a per-user basis.

    Put a .profile file in your home directory /home/USERNAME with the following contents:

    Handy Variables, Aliases, and Functions

    I suggest starting everything with some color variables, since they usually end up repeated a lot when creating a decent looking bash environment.

    That’s usually followed with prettification of PS1 and the most basic aliases.

    In order for this particular PS1 configuration to work must be used.

    Then comes all the fun stuff.

    Those are just a few examples of handy tools a developer can create when tailoring their bash environment.

    IBM i Specific Highlights

    Thanks @PHPDave for the inspiration.

    Those are a few of my favorite ones. Explore other ways to make your own environment more efficient. It’s what makes BASH fun and worthwhile.

    Putting It All Together

    There are a few placeholders in this example configuration. It should be combed through and tailored before use.

    Taking it all apart

    While it’s acceptable to have everything in one large .bashrc located at the root of one’s home directory, it’s a good idea to split up the configuration into smaller, more manageable files. Configurations can get large, especially when complex functions get thrown into the mix.

    My file structure ends up looking something like:

    To see how they connect, here are .bashrc, .bash_start, and .bash_functions:

    Leave a Reply

    Your email address will not be published. Required fields are marked *