Skip to content

Aix with no human readable ls

wordpress meta

title: 'AIX with no human readable ls'
date: '2013-07-17T09:23:13-05:00'
status: publish
permalink: /aix-with-no-human-readable-ls
author: admin
excerpt: ''
type: post
id: 405
    - AIX
tag: []
post_format: []

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