Skip to content

AIX with no human readable ls

I recently had to touch a pretty old AIX OS and it frustrated me not to have human readable output for ls. This function helped a little. An alias did not want to work because of all the quoting going on. Of course as you can notice I changed my shell prior to bash.

> oslevel -g
Fileset                                 Actual Level        Maintenance Level

> more .profile
function ls-h() {
  /usr/bin/ls -l "$@" | awk "{\$5=sprintf(\"%.2f GB\", \$5/1024^3)} 1";
export PATH

# alias has to many """ chars to work trying function ls-h
#alias lsh "ls -l \$@ | awk '{$5=sprintf("%.2f GB", $5/1024^3)} 1'"

> ls-h /u28/oracle/uat2data/
total 830472432   0.00 GB
-rw-r----- 1 ora dba 31.00 GB Jul 14 00:46 a_ora_file.dbf
Published inAIX