You are on page 1of 12

AIX commands you should not leave home without

Shiv Dutta, Senior Software Engineer, IBM


Summary: Do you ever wish you could answer some of your own questions when you work with AIX and your System p server? Do you ever feel
you could save time by not having to call on the support professionals all the time? Well, wish no more. Shiv Dutta discusses some of the AIX commands
that answer those questions and tells you how to enlarge the list of such answers.
Date: 14 Oct 2008
Level: Intermediate
PDF: A4 and Letter (301 KB | 18 pages)Get Adobe Reader
Also available in: Chinese
Activity: 81751 views
Comments: (View | Add comment - Sign in)
Average rating (91 votes)
Rate this article
Introduction
As you know, AIX has a vast array of commands that enable you to do a multitude of tasks. Depending on what you need to accomplish, you use only a
certain subset of these commands. These subsets differ from user to user and from need to need. However, there are a few core commands that you
commonly use. You need these commands either to answer your own questions or to provide answers to the queries of the support professionals.
In this article, I'll discuss some of these core commands. The intent is to provide a list that you can use as a ready reference. While the behavior of these
commands should be identical in all releases of AIX, they have been only tested under AIX V5.3.
Note:
The bootinfo command discussed in the following paragraphs is NOT a user-level command and is NOT supported in AIX V4.2 or later.
Commands
Kernel
How would I know if I am running a 32-bit kernel or 64-bit kernel?
To display if the kernel is 32-bit enabled or 64-bit enabled, type:
How do I know if I am running a uniprocessor kernel or a multiprocessor kernel?
/unix is a symbolic link to the booted kernel. To find out what kernel mode is running, enter ls -l /unix and see what file /unix it links to. The
following are the three possible outputs from the ls -l /unix command and their corresponding kernels:
Note:
AIX 5L Version 5.3 does not support a uniprocessor kernel.
How can I change from one kernel mode to another?
During the installation process, one of the kernels, appropriate for the AIX version and the hardware in operation, is enabled by default. Use the method
from the previous question and assume that the 32-bit kernel is enabled. Also assume that you want to boot it up in the 64-bit kernel mode. This can be
done by executing the following commands in sequence:
The /dev/hdiskxx directory is where the boot logical volume /dev/hd5 is located. To find out what xx is in hdiskxx, run the following command:
Sign in (or register) English IBM
Technical topics Evaluation software Community Events Search developerWorks
bootinfo -K
/unix -> /usr/lib/boot/unix_up # 32 bit uniprocessor kernel
/unix -> /usr/lib/boot/unix_mp # 32 bit multiprocessor kernel
/unix -> /usr/lib/boot/unix_64 # 64 bit multiprocessor kernel
ln -sf /usr/lib/boot/unix_64 /unix
ln -sf /usr/lib/boot/unix_64 /usr/lib/boot/unix
bosboot -ad /dev/hdiskxx
shutdown -r
lslv -m hd5
Page 1 of 12 AIX commands you should not leave home without
10/7/2013 https://www.ibm.com/developerworks/aix/library/au-aix_cmds/
Note:
In AIX V5.2, the 32-bit kernel is installed by default. In AIX V5.3, the 64-bit kernel is installed on 64-bit hardware and the 32-bit kernel is installed on
32-bit hardware by default.
Hardware
How do I know if my machine is capable of running AIX 5L Version 5.3?
AIX 5L Version 5.3 runs on all currently supported CHRP (Common Hardware Reference Platform)-based POWER hardware.
How do I know if my machine is CHRP-based?
Run the prtconf command. If it's a CHRP machine, the string chrp appears on the Model Architecture line.
How do I know if my System p machine (hardware) is 32-bit or 64-bit?
To display if the hardware is 32-bit or 64-bit, type:
How much real memory does my machine have?
To display real memory in kilobytes (KB), type one of the following:
Can my machine run the 64-bit kernel?
64-bit hardware is required to run the 64-bit kernel.
What are the values of attributes for devices in my system?
To list the current values of the attributes for the tape device, rmt0, type:
To list the default values of the attributes for the tape device, rmt0, type:
To list the possible values of the login attribute for the TTY device, tty0, type:
To display system level attributes, type:
How many processors does my system have?
To display the number of processors on your system, type:
How many hard disks does my system have and which ones are in use?
To display the number of hard disks on your system, type:
How do I list information about a specific physical volume?
To find details about hdisk1, for example, run the following command:
How do I get a detailed configuration of my system?
Type the following:
bootinfo -y
bootinfo -r
lsattr -El sys0 -a realmem
lsattr -l rmt0 -E
lsattr -l rmt0 -D
lsattr -l tty0 -a login -R
lsattr -E -l sys0
lscfg | grep proc
lspv
lspv hdisk1
lscfg
Page 2 of 12 AIX commands you should not leave home without
10/7/2013 https://www.ibm.com/developerworks/aix/library/au-aix_cmds/
The following options provide specific information:
For example, to display details about the tape drive, rmt0, type:
You can obtain similar information by running the prtconf command.
How do I find out the chip type, system name, node name, model number, and so forth?
The uname command provides details about your system.
AIX
What version, release, and maintenance level of AIX is running on my system?
Type one of the following:
How can I determine which fileset updates are missing from a particular AIX level?
To determine which fileset updates are missing from 5300-04, for example, run the following command:
What SP (Service Pack) is installed on my system?
To see which SP is currently installed on the system, run the oslevel -s command. Sample output for an AIX 5L Version 5.3 system, with TL4, and
SP2 installed, would be:
Is a CSP (Concluding Service Pack) installed on my system?
To see if a CSP is currently installed on the system, run the oslevel -s command. Sample output for an AIX 5L Version 5.3 system, with TL3, and CSP
installed, would be:
How do I create a file system?
The following command will create, within volume group testvg, a jfs file system of 10MB with mounting point /fs1:
The following command will create, within volume group testvg, a jfs2 file system of 10MB with mounting point /fs2 and having read-only permissions:
-p Displays platform-specific device information. The flag is applicable to AIX V4.2.1 or later.
-v Displays the VPD (Vital Product Database) found in the customized VPD object class.
lscfg -vl rmt0
uname -p Displays the chip type of the system. For example, PowerPC.
uname -r Displays the release number of the operating system.
uname -s Displays the system name. For example, AIX.
uname -n Displays the name of the node.
uname -a Displays the system name, nodename, version, machine ID.
uname -M Displays the system model name. For example, IBM, 9114-275.
uname -v Displays the operating system version.
uname -m Displays the machine ID number of the hardware running the system.
name -u Displays the system ID number.
oslevel -r
lslpp -h bos.rte
oslevel -rl 5300-04
oslevel s
5300-04-02
oslevel s
5300-03-CSP
crfs -v jfs -g testvg -a size=10M -m /fs1
Page 3 of 12 AIX commands you should not leave home without
10/7/2013 https://www.ibm.com/developerworks/aix/library/au-aix_cmds/
How do I change the size of a file system?
To increase the /usr file system size by 1000000 512-byte blocks, type:
Note:
In AIX V5.3, the size of a JFS2 file system can be shrunk, as well.
How do I mount a CD?
Type the following:
How do I mount a file system?
The following command will mount file system /dev/fslv02 on the /test directory:
How do I mount all default file systems (all standard file systems in the /etc/filesystems file marked by the mount=true attribute)?
The following command will mount all such file systems:
How do I unmount a file system?
Type the following command to unmount /test file system:
How do I display mounted file systems?
Type the following command to display information about all currently mounted file systems:
How do I remove a file system?
Type the following command to remove the /test file system:
How can I defragment a file system?
The defragfs command can be used to improve or report the status of contiguous space within a file system. For example, to defragment the file
system /home, use the following command:
Which fileset contains a particular binary?
To show bos.acct contains /usr/bin/vmstat, type:
Or to show bos.perf.tools contains /usr/bin/svmon, type:
How do I display information about installed filesets on my system?
Type the following:
How do I determine if all filesets of maintenance levels are installed on my system?
Type the following:
crfs -v jfs2 -g testvg -a size=10M -p ro -m /fs2
chfs -a size=+1000000 /usr
mount -V cdrfs -o ro /dev/cd0 /cdrom
mount /dev/fslv02 /test
mount {-a|all}
umount /test
mount
rmfs /test
defragfs /home
lslpp -w /usr/bin/vmstat
which_fileset svmon
lslpp -l
Page 4 of 12 AIX commands you should not leave home without
10/7/2013 https://www.ibm.com/developerworks/aix/library/au-aix_cmds/
How do I determine if a fix is installed on my system?
To determine if IY24043 is installed, type:
How do I install an individual fix by APAR?
To install APAR IY73748 from /dev/cd0, for example, enter the command:
How do I verify if filesets have required prerequisites and are completely installed?
To show which filesets need to be installed or corrected, type:
How do I get a dump of the header of the loader section and the symbol entries in symbolic representation?
Type the following:
How do I determine the amount of paging space allocated and in use?
Type the following:
How do I increase a paging space?
You can use the chps -s command to dynamically increase the size of a paging space. For example, if you want to increase the size of hd6 with 3 logical
partitions, you issue the following command:
How do I reduce a paging space?
You can use the chps -d command to dynamically reduce the size of a paging space. For example, if you want to decrease the size of hd6 with four
logical partitions, you issue the following command:
How would I know if my system is capable of using Simultaneous Multi-threading (SMT)?
Your system is capable of SMT if it's a POWER5-based system running AIX 5L Version 5.3.
How would I know if SMT is enabled for my system?
If you run the smtctl command without any options, it tells you if it's enabled or not.
Is SMT supported for the 32-bit kernel?
Yes, SMT is supported for both 32-bit and 64-bit kernel.
How do I enable or disable SMT?
You can enable or disable SMT by running the smtctl command. The following is the syntax:
The following options are available:
instfix -i | grep ML
instfix -ik IY24043
instfix -k IY73748 -d /dev/cd0
lppchk -v
dump -Htv
lsps -a
chps -s 3 hd6
chps -d 4 hd6
smtctl [ -m off | on [ -w boot | now]]
-m off Sets SMT mode to disabled.
-m on Sets SMT mode to enabled.
-w boot Makes the SMT mode change effective on next and subsequent reboots if you run the bosboot command before the next system reboot.
-w now Makes the SMT mode change immediately but will not persist across reboot.
Page 5 of 12 AIX commands you should not leave home without
10/7/2013 https://www.ibm.com/developerworks/aix/library/au-aix_cmds/
If neither the -w boot or the -w now options are specified, then the mode change is made immediately. It persists across subsequent reboots if you run the
bosboot command before the next system reboot.
How do I get partition-specific information and statistics?
The lparstat command provides a report of partition information and utilization statistics. This command also provides a display of Hypervisor
information.
Volume groups and logical volumes
How do I know if my volume group is normal, big, or scalable?
Run the lsvg command on the volume group and look at the value for MAX PVs. The value is 32 for normal, 128 for big, and 1024 for scalable volume
group.
How can I create a volume group?
Use the following command, where spartition_size sets the number of megabytes (MB) in each physical partition where the partition_size is expressed in
units of MB from 1 through 1024. (It's 1 through 131072 for AIX V5.3.) The partition_size variable must be equal to a power of 2 (for example: 1, 2, 4,
8). The default value for standard and big volume groups is the lowest value to remain within the limitation of 1016 physical partitions per physical
volume. The default value for scalable volume groups is the lowest value to accommodate 2040 physical partitions per physical volume.
How can I change the characteristics of a volume group?
You use the following command to change the characteristics of a volume group:
How do I create a logical volume?
Type the following:
How do I increase the size of a logical volume?
To increase the size of the logical volume represented by the lv05 directory by three logical partitions, for example, type:
How do I display all logical volumes that are part of a volume group (for example, rootvg)?
You can display all logical volumes that are part of rootvg by typing the following command:
How do I list information about logical volumes?
Run the following command to display information about the logical volume lv1:
How do I remove a logical volume?
You can remove the logical volume lv7 by running the following command:
The rmlv command removes only the logical volume, but does not remove other entities, such as file systems or paging spaces that were using the logical
volume.
How do I mirror a logical volume?
1. mklvcopy LogicalVolumeName Numberofcopies
2. syncvg VolumeGroupName
How do I remove a copy of a logical volume?
You can use the rmlvcopy command to remove copies of logical partitions of a logical volume. To reduce the number of copies of each logical partition
belonging to logical volume testlv, enter:
mkvg -y name_of_volume_group -s partition_size list_of_hard_disks
chvg
mklv -y name_of_logical_volume name_of_volume_group number_of_partition
extendlv lv05 3
lsvg -l rootvg
lslv lv1
rmlv lv7
rmlvcopy testlv 2
Page 6 of 12 AIX commands you should not leave home without
10/7/2013 https://www.ibm.com/developerworks/aix/library/au-aix_cmds/
Each logical partition in the logical volume now has at most two physical partitions.
Queries about volume groups
To show volume groups in the system, type:
To show all the characteristics of rootvg, type:
To show disks used by rootvg, type:
How to add a disk to a volume group?
Type the following:
How do I find out what the maximum supported logical track group (LTG) size of my hard disk?
You can use the lquerypv command with the -M flag. The output gives the LTG size in KB. For instance, the LTG size for hdisk0 in the following
example is 256KB.
You can also run the lspv command on the hard disk and look at the value for MAX REQUEST.
What does the syncvg command do?
The syncvg command is used to synchronize stale physical partitions. It accepts names of logical volumes, physical volumes, or volume groups as
parameters.
For example, to synchronize the physical partitions located on physical volumes hdisk6 and hdisk7, use:
To synchronize all physical partitions from volume group testvg, use:
How do I replace a disk?
1. extendvg VolumeGroupName hdisk_new
2. migratepv hdisk_bad hdisk_new
3. reducevg -d VolumeGroupName hdisk_bad
How can I clone (make a copy of) the rootvg?
You can run the alt_disk_copy command to copy the current rootvg to an alternate disk. The following example shows how to clone the rootvg to
hdisk1.
Network
How can I display or set values for network parameters?
The no command sets or displays current or next boot values for network tuning parameters.
How do I get the IP address of my machine?
Type one of the following:
lsvg
lsvg rootvg
lsvg -p rootvg
extendvg VolumeGroupName hdisk0 hdisk1 ... hdiskn
/usr/sbin/lquerypv -M hdisk0
256
syncvg -p hdisk4 hdisk5
syncvg -v testvg
alt_disk_copy -d hdisk1
ifconfig -a
host Fully_Qualified_Host_Name
Page 7 of 12 AIX commands you should not leave home without
10/7/2013 https://www.ibm.com/developerworks/aix/library/au-aix_cmds/
For example, type host cyclop.austin.ibm.com.
How do I identify the network interfaces on my server?
Either of the following two commands will display the network interfaces:
To get information about one specific network interface, for example, tr0, run the command:
How do I activate a network interface?
To activate the network interface tr0, run the command:
How do I deactivate a network interface?
For example, to deactivate the network interface tr0, run the command:
How do I display routing table, interface, and protocol information?
To display routing table information for an Internet interface, type:
To display interface information for an Internet interface, type:
To display statistics for each protocol, type:
How do I record packets received or transmitted?
To record packets coming in and going out to any host on every interface, enter:
The trace information is placed into the /tmp/nettrace file.
To record packets received on an interface en0 from a remote host airmail over the telnet port, enter:
The trace information is placed into the /tmp/telnet.trace file.
Workload partitions
How do I create a workload partition?
To create a workload partition named temp with the IP Address xxx.yyy.zzz.nnn, type:
To create a workload partition with the specification file wpar1.spec, type:
How do I create a new specification file for an existing workload partition wpar1?
To create a specification file wpar2.spec for an existing workload partition wpar1, type:
How do I start a workload partition?
lsdev -Cc if
ifconfig -a
ifconfig tr0
ifconfig tr0 up
ifconfig tr0 down
netstat -r -f inet
netstat -i -f inet
netstat -s -f inet
iptrace /tmp/nettrace
iptrace -i en0 -p telnet -s airmail /tmp/telnet.trace
mkwpar -n temp -N address= xxx.yyy.zzz.nnn
mkwpar -f /tmp/wpar1.spec
mkwpar -e wpar1 -o /tmp/wpar2.spec -w
Page 8 of 12 AIX commands you should not leave home without
10/7/2013 https://www.ibm.com/developerworks/aix/library/au-aix_cmds/
To start the workload partition called temp, type:
How do I stop a workload partition?
To stop the workload partition called temp, type:
How do I view the characteristics of workload partitions?
To view the characteristics of all workload partitions, type:
How do I log in to a workload partition?
To log in to the workload partition named wpar1 as user foo, type:
How do I run a command in a workload partition?
To run the /usr/bin/ps command as user root in a workload partition named howdy, type:
How do I remove a workload partition?
To remove the workload partition called temp, type:
To stop and remove the workload partition called temp preserving data on its file system, type:
Note: Workload Partitions (WPARs), a set of completely new software-based system virtualization features, were introduced in IBM AIX Version 6.1.
Performance monitoring tools
How do I display virtual memory statistics?
To display a summary of the virtual memory statistics since boot, type:
To display five summaries at 2-second intervals, type:
To display a summary of the statistics for all of the workload partitions after boot, type:
To display all of the virtual memory statistics available for all of the workload partitions, type:
How do I display statistics for all TTY, CPU, and Disks?
To display a single set of statistics for all TTY, CPU, and Disks since boot, type:
To display a continuous disk report at 2-second intervals for the disk with the logical name disk1, type:
startwpar temp
stopwpar temp
lswpar
Name State Type Hostname Directory
---------------------------------------------------------------------------------
bar A S bar.austin.ibm.com /wpars/bar
foo D S foo.austin.ibm.com /wpars/foo
trigger A A trigger /
clogin wpar1 -l foo
clogin howdy -l root /usr/bin/ps
rmwpar temp
rmwpar -p -s temp
vmstat
vmstat 2 5
vmstat -@ ALL
vmstat -vs -@ ALL
iostat
iostat -d disk1 2
Page 9 of 12 AIX commands you should not leave home without
10/7/2013 https://www.ibm.com/developerworks/aix/library/au-aix_cmds/
To display 6 reports at 2-second intervals for the disk with the logical name disk1, type:
To display 6 reports at 2-second intervals for all disks, type:
To display only file system statistics for all workload partitions, type:
To display system throughput of all workload partitions along with the system, type:
How do I display detailed local and remote system statistics?
Type the following command:
To go directly to the process display, enter:
To go directly to the logical partition display, enter:
To go directly to the disk metric display, enter:
To go directly to the file system display, enter:
How do I report system unit activity?
Type the following command:
To report processor activity for the first two processors, enter:
This produces output similar to the following:
Conclusion
Admittedly, a list such as this can be helpful in quickly answering some of your own questions. However, it does not cover everything that you might
need. You can extend the usefulness of such a list by adding other commands that answer additional questions not addressed here.
Resources
Learn
z AIX Information Center: This site provides the latest documentation on AIX.
z Introduction to Workload Partition Management in IBM AIX Version 6.1: This Redbook presents Workload Partitions (WPARs), a set of
completely new software-based system virtualization features introduced in IBM AIX Version 6.1.
z The AIX and UNIX developerWorks zone provides a wealth of information relating to all aspects of AIX systems administration and expanding
your UNIX skills.
z developerWorks technical events and webcasts: Stay current with developerWorks technical events and webcasts.
iostat disk1 2 6
iostat -d 2 6
iostat -F -@ ALL
iostat -s -@ ALL
topas
topas -P
topas -L
topas -D
topas -F
sar
sar -u -P 0,1
cpu %usr %sys %wio %idle
0 45 45 5 5
1 27 65 3 5
Page 10 of 12 AIX commands you should not leave home without
10/7/2013 https://www.ibm.com/developerworks/aix/library/au-aix_cmds/
z AIX Wiki: Visit this collaborative environment for technical information related to AIX.
z Podcasts: Tune in and catch up with IBM technical experts.
z Browse the technology bookstore for books on these and other technical topics.
Get products and technologies
z IBM trial software: Build your next development project with software for download directly from developerWorks.
Discuss
z Participate in the AIX and UNIX forums:
{ AIX Forum
{ AIX Forum for developers
{ Cluster Systems Management
{ IBM Support Assistant Forum
{ Performance Tools Forum
{ Virtualization Forum
{ More AIX and UNIX Forums
{ AIX Networking
About the author
Shiv Dutta is a Solutions Relationship Manager in the IBM Systems and Technology Group where he is responsible for the ISV relationships for all IBM
Tape Storage Products. Shiv has worked extensively in the System p and AIX area.He is a co-author of a couple of IBM Redbooks on AIX. You can
reach him at sdutta@us.ibm.com.
Close [x]
developerWorks: Sign in
IBM ID:
Need an IBM ID?
Forgot your IBM ID?
Password:
Forgot your password?
Change your password
Keep me signed in.
By clicking Submit, you agree to the developerWorks terms of use.
The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is
displayed to the public and will accompany any content you post. You may update your IBM account at any time.
All information submitted is secure.
Close [x]
Choose your display name
The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the
content you post on developerWorks.
Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your
email address for privacy reasons.
Display name: (Must be between 3 31 characters.)
By clicking Submit, you agree to the developerWorks terms of use.
Submit Cancel
Submit Cancel
Page 11 of 12 AIX commands you should not leave home without
10/7/2013 https://www.ibm.com/developerworks/aix/library/au-aix_cmds/
All information submitted is secure.
Average rating (91 votes)
1 star 1 star
2 stars 2 stars
3 stars 3 stars
4 stars 4 stars
5 stars 5 stars
Add comment:
Sign in or register to leave a comment.
Note: HTML elements are not supported within comments.
Notify me when a comment is added1000 characters left
I found your document was very useful and informative, thanks
Posted by bcormier on 06 June 2013
Report abuse
Submit

Post Post
Print this page Share this page Follow developerWorks
About
Help
Contact us
Submit content
Feeds Report abuse
Terms of use
Third party notice
IBM privacy
IBM accessibility
Faculty
Students
Business Partners
Page 12 of 12 AIX commands you should not leave home without
10/7/2013 https://www.ibm.com/developerworks/aix/library/au-aix_cmds/

You might also like