4

In another thread (What's the easiest way to sort a list like this) someone asked if we had "GNU ls" on the system because it would provide a solution. We do NOT have GNU ls installed but it got me thinking:

  1. when you install things like "GNU ls" does it just install "ls" or does it contain replacements for a suite of Unix commands?

  2. Would GNU ls support all the flags that the base-O/S ls command supports?

The second question is because we have a lot of ksh93 scripts on our AIX systems, and I want to ensure they continue to function as expected. If I installed GNU ls, would I just use a fully-qualified path to GNU ls when I needed it's functionality in a given ksh script, say /opt/GNU/ls? Is that how one would typically add/use a GNU command on a mature system?

9
  • Taken from ibm.com/developerworks/community/forums/html/… : Download and install the GNU Coreutils from AIX Toolbox for Linux Applications www-03.ibm.com/systems/p/os/aix/linux/download.html This is going to install many commands under the /usr/linux/bin path Dec 7, 2017 at 15:43
  • Many of the packages in the AIX Toolbox for Linux Applications install to a separate tree, such as /opt/freeware, and create symlinks to /usr/bin or /bin. I don't see an ls package there. If you compile from source, then you'd be free to place it anywhere you like.
    – Jeff Schaller
    Dec 7, 2017 at 15:43
  • Some package or ports systems prefix the GNU commands with g so you would run gls which would help avoid confusion with the base OS version of the program, assuming a PATH set to contain sets of utilities.
    – thrig
    Dec 7, 2017 at 16:16
  • @JeffSchaller, has ksh93 been built with the ls builtin on AIX (command /opt/ast/bin/ls --man)? It is at least as feature full as GNU ls. Dec 7, 2017 at 16:35
  • @ Stéphane: command /opt/ast/bin/ls --man results in: ksh93: /opt/ast/bin/ls: not found. With a $SHELL of /usr/bin/ksh93, type ls results in: ls is /usr/bin/ls
    – Jeff Schaller
    Dec 7, 2017 at 16:43

2 Answers 2

0

You can build GNU coreutils from source, and manually copy the resulted ls(1) command as another name, under PATH, such as /usr/bin/gls.

For example the simplest steps are:

./configure <configure-options-you-may-want>
make
cp src/ls /usr/bin/gls
0
  1. That depends on how you install your GNU binaries. The most common way is either Michael Perzls site or IBMs AIX Toolbox for Open Source Software. In either case (and most probably with other packages too, although i have never used any other than these two) binaries are not getting installed in /bin and so do not overwrite the systems binaries. In this case you can select which binaries - AIX or GNU - to use simply by changing your PATH variable. i.e.:
      PATH=/usr/local/gnu/bin             # GNU binaries
      PATH="$PATH:/bin:/usr/bin"          # AIX system binaries
      PATH="$PATH:/some/other/path:[...]"
      export PATH

Reverse the first two lines (GNU binaries are supposedly installed in /usr/local/bin here) to revert to using the AIX binaries (first).

Similar for the content of the package: that depends on which package you use, although AFAIK there is no package containing GNU-ls from IBM.

  1. This is hard to say. GNU tools are quite volatile and follow now given ruleset (like, i.e. AIX does with POSIX), so what is correct today might well be wrong tomorrow or vice versa. Some GNU utilities try to follow POSIX rules, others don't. I suppose even this attitude changes over time as the population of contributors to a certain utility changes.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .