20

How do I tell which AIX version am I running?

webwesen
  • 985

5 Answers5

21

You are correct in the fact that oslevel will give you the current installed version, but that is not always enough information particularily if you are asked the question by support personnel.

oslevel <--- this will only give you the Base Level

To be more precise you should use the following command which will give you additional Technology Level, Maintenance Level and Service Pack level information.

    # oslevel -s
5300-09-02-0849

This will give you

  • "5300" - Base Level (OS Version 5.3)
  • "09" - Technology Level (former Maintenance Level)
  • "02" - Service Pack
  • "0849" - Service Pack Release (49th week of the year 2008)

On some older versions of AIX the -s option is not available in which case you should use the -r option which will report as far as the Technology level

I hope this helps

Mike Scheerer

cdanzmann
  • 103
10

I just added this to my ~/.profile, so I immediately see the AIX version on login:

function aixversion {
  OSLEVEL=$(oslevel -s)
  AIXVERSION=$(echo "scale=1; $(echo $OSLEVEL | cut -d'-' -f1)/1000" | bc)
  AIXTL=$(echo $OSLEVEL | cut -d'-' -f2 | bc)
  AIXSP=$(echo $OSLEVEL | cut -d'-' -f3 | bc)
  echo "AIX ${AIXVERSION} - Technology Level ${AIXTL} - Service Pack ${AIXSP}"
}
aixversion

Example output:

AIX 7.1 - Technology Level 3 - Service Pack 1

nb: This function is compatible with both KSH and BASH, so you can put in ~/.bashrc instead if you are a BASH fan.

nb2: The last 4 digits from oslevel are the year and week the SP was released. I don't particularly care to see that, so I left it out. I was happy enough with Version/TL/SP.

EDIT 2018-02-22: I just came up with an equivalent but shorter implementation, and no longer depends on bc and uses awk instead of cut & bc.

As a one-liner:

oslevel -s | awk -F- '{printf "AIX %.1f - Technology Level %d - Service Pack %d\n",$1/1000,$2,$3}'

Output:

AIX 5.3 - Technology Level 9 - Service Pack 2

As a shell function:

aixversion() {
  oslevel -s | awk -F- '{printf "AIX %.1f - Technology Level %d - Service Pack %d\n",$1/1000,$2,$3}'
}

aixversion

Output:

AIX 5.3 - Technology Level 9 - Service Pack 2
7
$ man oslevel
$ oslevel
6.1.0.0    <- what I was looking for
webwesen
  • 985
3

You can use "uname" with various options:

$ uname -v
5
$ uname -r
3
0

You can use the following command:

oslevel -s

It will show result like below.

6100-09-09-1717

Which translates to:

os version 6.1

TL level 9

service pack 9

release date (year and week)

Anwar khan
  • 11
  • 2