10 AIX Commands to Add to Your Toolbox

Posted on: Mon, May 21, 2018 10:06 PM. This news has been viewed 437 times.

 

 

 

Many UNIX commands work across the spectrum of UNIX flavors—but there are specific commands that are geared specifically for AIX. Learning these is essential to being a successful AIX systems administrator. This list will focus on commands that are more geared to AIX, but a few can be used on other flavors, including Linux. While you can perform many sysadmin tasks with the AIX front end of Smit or Smitty, if you choose to eliminate the command line from your basic repertoire of tools, your skill as an admin may start to dry up. Regardless of how useful Smit may be, the command line can be your best friend—if you allow it to be. Let’s start!

#10. instfix

Syntax:

instfix [ -T [ -M Platform ] ] [ -s String ] [ -S ] [ -k Keyword | -f File ] [ -p ] [ -d Device ] [ -i [ -c ] [ -q ] [ -t Type ] [ -v ] [ -F ] ] [ -a ] [ -R ]

This command is used to determine if a fix is installed on your system and can also be used to install a fix or set of fixes.

How do you check if all file sets of your maintenance level is installed?

# instfix –I | grep ML
#9. ifconfig

Syntax:

ifconfig -a [ -l ] [ -d ] [ -u ] [ protocolfamily ]

This is one of those commands that’s available on every flavor of UNIX and shouldn’t be a surprise to you. Though I will usually use Smit when working with my adapters, I find that ifconfig is much more helpful in terms of providing me quick and dirty information about my current configuration for my network interfaces. While you can change the attributes of your interface by using ifconfig, most AIX admins know that your changes will be lost on a reboot. I typically only use ifconfig to view my environment—here’s how you do it:

# ifcongig –a

The –a flag will display information about all the interfaces on your system

#8. mksysb

Syntax:

mksysb [ -a ] [ -A ] [ -b number ] [ -e ] [ -F filename ] [ -i ] [ -m ] [ -p ] [ -P ] [ -t argument ] [ -v ] [ -V ] [-x file ] [ -X ] [-Z] [ -G | -N ] [-M] [ -T ] device | file

This is another AIX specific command—and I love it. It’s the best way of creating backups of your volume groups. You can use the mksysb to reinstall your entire system back to its original state. If you run this using tape, you can boot from this as well. I don’t know of an AIX admin who hasn’t needed a mksysb to save their lives at some point!

# mksysb – I /dev/rmt0

This command will generate the system backup for you and output the data to a tape device named /dev/rmt0.

Other command that you should also familiarize yourself with are tar and cpio. cpio is not used as often in today’s world, but I still recall fondly (from memory) one of the first commands I ever used in UNIX.

# cpio –icdumBv <
/dev/rmt0 – 

which provided me with basic information about the output of an archive, from my SCO Unix system back in the 80s. Why I can remember this and not my anniversary, I’ll never know!

#7.  errpt

Syntax:

errpt [ -@ wpar_name ] [ -a ] [ -A ] [ -c ] [ -d ErrorClassList ] [ -D ] [ -e EndDate ] [ -g ] [ -i File ] [ -I File ] [ -j ErrorID [ ,ErrorID ] ] | [ -k ErrorID [ ,ErrorID ] ] [ -J ErrorLabel [ ,ErrorLabel ] ] | [ -K ErrorLabel [ ,ErrorLabel ] ] [ -l SequenceNumber ] [ -m Machine ] [ -n Node ] [ -s StartDate ] [ -F FlagList ] [ -N ResourceNameList ] [ -P ] [ -R ResourceTypeList ] [ -S ResourceClassList ] [ -T ErrorTypeList ] [ -y File ] [ -z File ]

This is another AIX specific command and is an integral part of anyone’s toolkit. How else would you look at both the detail and summary of errors on your system? The command generates a nice report from the error log.

# errpt – a  

Using the –a option will provide the information in detail. If you run it without any options, it will display a basic summary report.

#6. prtconf

Syntax:

prtconf [ -c ] [ -k ] [ -L ] [ -m ] [ -s ] [ -v ]

When I first hop on a system, I want to know what I’m working on. That’s what prtconf will provide you with. I’ll also use oslevel and lsmcode commands to provide me information on the actual level of AIX I’m using, as well as the firmware, but I don’t use these commands as often.

If you run this without flags, you’ll get the machine type, model, filesystem information, paging information, CPU type, clock speed, among other information. While there are other ways to get memory, you can also get a quick snapshot of memory using the –m flag

# prtconf – m
#5. cfgmgr

cfgmgr [ -f | -s | -p Phase ] [ -i Device ] [ -u Drc Name | -l Name ] [ -v ]

Don’t you love config manager? This AIX specific command allows you to configure and/or install device software on your system. cfgmgr actually will come up during a system boot, and configures all necessary devices that allow you to use your system.

If you want to install all detected devices attached to your scsci0 adapter, this is what you do:

#  cfgmgr –l scsi0
#4.  lsps

Syntax:

lsps { -s | [ -c | -l ] { -a | -t { lv | nfs | ps_helper} | PagingSpace } }

This is quickest way to get information about your paging space. It provides the name of the paging space, the physical volume attributes, and a wealth of other information.

# lsps – a

Using the –a flag, it provide the characteristics of all paging space attributes. I also like to use the –s flag, which reports a summary of the total amount of paging space used on your system.

#3. Vmstat

Syntax:

vmstat [ -f ] [ -i ] [ -s ] [ -I[-W]] [ -t ] [ -v ] [ -h ] [ -w ] [ -l ] [-c] [ -@ wparname | ALL] [{ -p | -P } physicalvolume | ALL] ALL] [-S power] [physicalvolume]

I know there are many other performance commands that you can use on your system. Being old school, vmstat will be one of the first performance type command that I will use. I like vmstat, because it will quickly tell me information about all system resources (RAM, IO and CPU) and let me know if there is a problem.

# vmstat 1 

Running it this way, will generate a report every second, and allow you to watch its output for as long as you would like, until you interrupt it.

#2. lspv

Syntax:

lspv [ -L ] [ -P ] [ -l | -p | -M ] [ -n descriptorphysicalvolume] [ -v volumegroupid] physicalvolume

This command will provide me with information about the physical volumes in your volume group.

# lspv hdisk0

This command will provide you with all the physical characteristics of your physical volumes for volume group hdisk0

Of course you should also know lslv, which does the same with your logical volumes.

#1.  netstat

I love netstat and use it all the time. Available in all flavors of UNIX and Linux, it should be your go-to command for anything network related.

Syntax:

/bin/netstat [ -n ] [{-A -a } | { -r -C -i -I Interface } ] [ -f AddressFamily] [ [ -p Protocol ] | [ -@ WparName ] ] [ Interval ]

# netstat –rn

I use these flags to let me know what my default gateway is.

One of the reasons I hesitated to create a top-10 list like this is because there are so many commands that should be in your toolbox, it’s hard to leave one out. So let’s look at the contenders that didn’t make the list.

Honorable Mentions

  1. chfs – You have to know how to quickly add space to your filesystem on the fly.
  2. df – This is used to provide information about your filesystems. I’ll usually use the –k option to provide me with the info in 1024 byte blocks, though you can do this in MB with the –m flag.
  3. bdf – This is a similar command to df, which you should know how to use. This command has its roots in BSD.
  4. lsattr – This command provides the attributes about your devices. Using these flags will provide you with quick snapshot of your memory: lsattr –El sys0 –a realmem
  5. lscfg – Another great command that provides detailed config information about your system
  6. lsmap – There’s no better command that you have to know when working with your vio LPARs.
  7. clverify – if you have a PowerHA or HACMP cluster, you need to know how to verify it and fix problems by using this utility
  8. lslpp – This command will help you identify installed filesets.
  9. chmod – This command is used to alter your permissions on a file or directory.
  10. pwd – This simple command outputs the directory you are currently visiting, and has saved my life many times. I learned to use pwd frequently on newer hosts that I use, because if I remove a file or directory from the wrong place, I could be in big trouble. If I preface removing stuff with pwd, I can make sure I’m in the right place. Of course, you can always export your current directory from your .profile – if you want to always see where you are without using pwd. While we’re on the subject, always use the –i flag with rm, that way the system will ask you nicely, if you are sure you want to remove that file.

Most AIX admins are becoming increasingly more reliant on GUI front-ends, and smit may be one of the best utilities that AIX has to offer, don’t become overly reliant on it. A good UNIX admin must know how to use the command line and it can be your best friend, if used properly.