6

Recently my company is moving an application system from mainframe z/OS to AIX. I have some experience on Ubuntu, but am completely new to AIX 6.1. Just wondering a few question:

  1. We use putty to connect to the AIX servers, but putty is very difficult to operate. You cannot use up arrow to recall the command in history. Is there any better terminal that is more user friendly in AIX?
  2. AIX is using ksh, instead of Bash. Is there any login shell with a special name that every time you login it can execute automatically, just like the .bashrc in ubuntu?
  3. There's no gedit nor nano nor vim on my AIX, only vi. Is there any text editor that I can download/use without root permission?
  • I found the answer for Q2. It's .profile. Though someone says it should be .kshrc or .ksrc, as per my test, on my AIX, it's .profile only. – 0PT1MU5 PR1ME Feb 17 '17 at 3:26
  • /usr/bin/ksh93 should support .kshrc – DarkHeart Feb 17 '17 at 5:39
  • you're right. I did find ksh93. – 0PT1MU5 PR1ME Feb 17 '17 at 14:11
  • All shells (bash included) should support .profile – OrangeDog Feb 17 '17 at 16:15
9

The default login shell for AIX is not bash - it is ksh/posix. The reason why the "up" arrow isn't working is because KSH is set to "vi" mode (bash can do this too). You want "emacs" mode:

set -o emacs

The .bashrc equivalent is .profile. You can put the above in there to change it permanently. AIX actually gives you two versions of KSH - ksh88 (default) and ksh93. The latter supports .kshrc as well

You can also install bash (and vim, nano etc) on AIX using an RPM available from one of the publicly available repositories.

  • Oh yeah, I forgot that AIX uses ksh88 by default (+1). Which, well, is quite old. On the other hand i believe that the arrows should still work inside set -o vi. The arrows are more at its loss with ksh itselff. And I'm confident that PuTTY has a workaround in its config pane, although i had not used that for 10 years. – grochmal Feb 17 '17 at 15:44
  • thanks. set -o emacs works and made my life easier. – 0PT1MU5 PR1ME Feb 17 '17 at 18:21
7

I believe that all three questions are answered by going to the IBM toolbox and installing yum. From there you have the range of the RPMs provided by IBM (compiled open source packages), or, moreover from perlz which offers a much bigger range. Note that perlz is a project completely unrelated to IBM.

Also, to install the yum RPM you need yum. But people figured out that that is not very user friendly so the yum readme explains two methods to install yum. Either you can install all RPMs by hand (it lists all of them) or download a full bundle and install them.

And the questions:

We use putty to connect to the AIX servers, but putty is very difficult to operate. You cannot use up arrow to recall the command in history. Is there any better terminal that is more user friendly in AIX?

You can PuTTY has a configuration parameter that switches between different types of arrow coding. If I'm not mistaken (haven't used PuTTY for a long time) the default is "Linux" which is escaping with <ESC>[[. If I remember correctly I needed to change that config to use PuTTY to connect directly to an AIX box.

AIX is using ksh, instead of Bash. Is there any login shell with a special name that every time you login it can execute automatically, just like the .bashrc in ubuntu?

bash does use .profile too, for login shells. When connecting through PuTTY you are using a login shell. Therefore installing (and using) bash (through perlz, see above) instead of ksh is an option. ksh is POSIX compliant but lacks several features that people are used to on bash.

There's no gedit nor nano nor vim on my AIX, only vi. Is there any text editor that I can download/use without root permission?

Again perlz, there is a nano package and a vim package.

Extra considerations (disclaimer)

If you are using the AIX machine in production and realy on IBM for maintenance, the use of `perlz* packages may be a violation of contract with IBM. Do check that, IBM is not famous for being lenient on contract clauses.

One way to get around the problem (at least how we got around it where I worked with AIX) was to install perlz packages on development servers but not on production servers. And we needed to take care of the development servers ourselves. In such a case (and if you install bash) remember to use #!/bin/ksh and not #!/bin/sh in scripts to prevent surprises in production.

Also, AIX 6.1 is quite old. I remember using it in 2009. The current version is 7.2, if you are switching servers to new ones I see no reason to use the old version.

  • 4
    Or don't change the system's default shell. Just set your personal login shell to bash. – OrangeDog Feb 17 '17 at 16:18
  • @OrangeDog - heh, yeah, fully agree, But you never know what another developer will do when working as a team. And better be safe. And, yes, it did happen to me to run a script with the wrong shell because someone else changed it :) – grochmal Feb 17 '17 at 17:11
  • Don't give them root access if you can't trust them not to change the system shell. – OrangeDog Feb 17 '17 at 17:12
  • I am not the AIX operation system admin. I am just a supporter for an application system. As I don't have the root permission, I don't have to worry about changing the system default shell. Just out of curiosity, in scripts, the first shebang line should always specify which shell to use, why it can still cause 'run a script with the wrong shell' issue? – 0PT1MU5 PR1ME Feb 17 '17 at 17:18
  • @0PT1MU5PR1ME - Someone may think that it would be good to have bash as the default for new users and (instead of changing the skeleton) symlink /bin/sh to /bin/bash. The you test the script and all works. But, on a new (or production, or client, machine) /bin/sh would be symlinked to /bin/ksh as the is the default that IBM sets on new machines. – grochmal Feb 17 '17 at 18:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.