For those who have been following my bite size BASH tutorial on You Tube, I thought it about time I wrote an article about a very useful BASH utility that’s available for our IBM i, and of course, plug my BASH videos at https://bit.ly/3IXBkm6 at the same time!
This helpful utility was developed by my fellow IBM Champion, Josh Hall. His open-source GitHub repository can be found at https://github.com/jbh/ibmi-Dotfiles
Take a look, it is well worth a browse if you are learning Bash shell scripting.
This utility is installed in a users home directory and will not affect other users.
First thing, what are dot files?
Traditionally, Dotfiles are used to customise your system.
The name Dotfiles originated from the configuration files, in Unix/Windows like systems, that start with a dot. An example of this is the .git directory and a .profile file for BASH.
Installing Dot Files
As Dotfiles are held in a separate repository from IBMs open source repositories, there are a couple of additional steps we have to take to install Dotfiles.
Do not be put off by this, it is only a couple of addition steps.
Firstly, make sure you have the yum utilities installed. This can be achieved by running, from a shell session, the following command
yum install yum-utils
then add the additional repository,
yum yum-config-manager –add-repo http://rpms.sobo.red/ibmi/
Once the above steps have been taken, we can install Dotfiles by using yum.
Again, from a shell session, run the command listed below.
yum install ibmi-Dotfiles
If you get any problems with the package not being found, it is worth cleaning up yum.
You can do this by running the YUM clean up command.
yum clean metadata
Once the additional repo has been loaded in yum, you will see the Dotfiles package using Open-Source Package Management from ACS.
As can be seen from the figure below, I have the Dotfiles package installed at version 1.3.0
Once the Dotfiles package has been installed globally, we must run the setup program for individual users.
Remember, Dotfiles is configured in a user’s home directory, so we install them by just running the ibmi-dotfiles script and answer any questions it prompts for.
Next, we must restart our shell BASH session to allow Dotfiles to be in effect.
This is achieved by either restarting your BASH session or calling reload (part of Dotfiles) which will force a restart of all the dot files in your BASH session.
After restarting our session, we see the figure below, letting us know that changes have been made to our login script.
- An informational message to inform the user that Dotfiles has amended your login script
- The ugly BASH prompt has been replaced, showing
- The user that has signed on
- The server name you are connected to
- The current directory
- The current GIT branch (if GIT is used in this directory)
If you do not want your login script to show either the BASH version, nor the Dotfiles informational message shown, just place a comment character (the # in BASH) as the first character on lines 15 and 18 to 20 in the .bash_profile script in your home directory.
Dotfiles include configuration files for many applications we use in a Bash session.
The table below details these files, which can be found in your home directory.
Or shortcuts. I was taught to touch type over 50 years ago in the Royal Navy, so it is about time for these fingers to take a rest, and that’s where the Dotfiles comes into play.
Dotfiles will add a set of BASH aliases to let your fingers take a break!
The table below shows the directory listing aliases that are included with Dotfiles.
If you have any BASH aliases, or anything else, you think will help other IBM i people, why not add them to this open-source project.
For those that use GIT (if not, why not?), Dotfiles also includes some handy aliases for GIT too.
Another great addition to the open source on IBM i catalogue. Make use of this facility, you will benefit.
I would like to thank Josh Hall for including the logo at the top of this article as a logo for his Dotfiles project.
This shows that you do not have to add programming features to contribute to open source. There are many areas where we can have an impact, with testing, documentation, etc to name a couple. Get involved!
All the examples I have written for this article, and previous ones, can be found on my open-source repository on GitHub, which can be found at https://github.com/AndyYouens/f_Learning
If you have any questions, either on this article, or anything else on the IBM i, use the comments below, or send me a message on twitter @AndyYouens
Andy Youens is an IBM i consultant/instructor at Milton Keynes, UK-based FormaServe Systems with over 40 years IBM midrange experience.