BrianGarland / blog

This is my blog
1 stars 0 forks source link

Personalize your shell when accessing IBM i via ssh #5

Open BrianGarland opened 4 years ago

BrianGarland commented 4 years ago

If you're getting into the IBM i open-source community the recommendation is to use ssh to connect instead of QP2TERM.

There are some customizations you can do to make this a better experience. Every time you connect the system looks for a file called .profile in your home folder (usually /home/username in the IFS) and executes the commands in it. Here is my current .profile and an explanation of the contents.

# put new packages in front of existing path
PATH=/QOpenSys/pkgs/bin:/QOpenSys/pkgs/lib/nodejs8/bin:$PATH
export PATH

# detect if we're in a PASE shell
/QSYS.LIB/QSHELL.LIB/UNAME.PGM > /dev/null 2>&1

if [ $? != 0 -a "$SHELL" != "/usr/bin/bash" ]
then
  exec /QOpenSys/pkgs/bin/bash
fi

# set info for yum
export LC_ALL=EN_US

# set the JDK to use
export JAVA_HOME=/QOpenSys/QIBM/ProdData/JavaVM/jdk80/32bit

Lines starting with a # are comments. They act as section headings in my .profile file. I'll describe each section below.

Section 1: The first two commands adjust the path that will be used when looking for commands you type in. It adds the bin folder for all the open-source utilities installed via yum and the node8 folder. (I know that's out of date but I haven't had the need for a newer version).

Section 2: The next set of commands make sure that bash is being used for the shell. Bash is my preferred shell. There are many to try.

Section 3: The third section sets a flag so that yum has the correct character set for me.

Section 4: The final section sets my java path.

So, open up your favorite editor and create your own .profile with your own preferences.