[分享]AIX常用命令

rongshiyuan發表於2012-11-06
[分享]AIX常用命令

AIX commands you should not leave home without

Document options
Print this page

E-mail this page

Discuss

Free software for rapid results
Kick-start your Java apps

Rate this page
Help us improve this content


Level: Intermediate

Shiv Dutta, Technical Consultant, IBM


06 May 2003
Updated 14 Jun 2005

Do you ever feel you wish you could answer some of your own questions when you work with AIX? and your pSeries? 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.
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 support queries of 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 5.3.

Note:
The bootinfo command discussed in the following paragraphs is NOT a user-level command and is NOT supported in AIX 4.2 or later.


Back to top

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:

bootinfo -K


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:


/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


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. Let us use the method from the previous question and assume the 32-bit kernel is enabled. Let us 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:


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


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:


lslv -m hd5


Note:
In AIX 5.2, the 32-bit kernel is installed by default. In AIX 5.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 would 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 would 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 would I know if my pSeries machine (hardware) is 32-bit or 64-bit?

To display if the hardware is 32-bit or 64-bit, type:

bootinfo -y


How much real memory does my machine have?

To display real memory in kilobytes (KB), type one of the following:

bootinfo -r


lsattr -El sys0 -a realmem

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:


lsattr -l rmt0 -E


To list the default values of the attributes for the tape device, rmt0, type:

lsattr -l rmt0 -D


To list the possible values of the login attribute for the TTY device, tty0, type:

lsattr -l tty0 -a login -R


To display system level attributes, type:

lsattr -E -l sys0


How many processors does my system have?

To display the number of processors on your system, type:

lscfg | grep proc


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:

lspv


How do I get a detailed configuration of my system?

Type the following:


lscfg


The following options provide specific information: -p Displays platform-specific device information. The flag is applicable to AIX 4.2.1 or later.
-v Displays the VPD (Vital Product Database) found in the customized VPD object class.


For example, to display details about the tape drive, rmt0, type:


lscfg -vl rmt0


You can obtain very 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. 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.
uname -u Displays the system ID number.


AIX

What version, release, and maintenance level of AIX is running on my system?

Type one of the following:

oslevel -r


lslpp -h bos.rte

How do I change the size of a filesystem?

To increase the /usr filesystem size by 1000000 512-byte blocks, type:

chfs -a size=+1000000 /usr


Note:
In AIX 5.3, the size of a JFS2 file system can be shrunk as well.

How do I mount a CD?

Type the following:

mount -V cdrfs -o ro /dev/cd0 /cdrom


How do I get the IP address of my machine?

Type one of the following:

ifconfig -a


host Fully_Qualified_Host_Name

For example, host cyclop.austin.ibm.com.

Which fileset contains a particular binary?

To show bos.acct contains /usr/bin/vmstat, type:

lslpp -w /usr/bin/vmstat


Or to show bos.perf.tools contains /usr/bin/svmon, type:

which_fileset svmon


How do I determine if all filesets of maintenance levels are installed on my system?

Type the following:

instfix -i | grep ML


How do I determine if a fix is installed on my system?

To determine if IY24043 is installed, type:

instfix -ik IY24043


How do I verify if filesets have required prerequisites and are completely installed?

To show which filesets need to be installed or corrected, type:

lppchk -v


How do I get a dump of the header of the loader section and the symbol entries in symbolic representation?

Type the following:

dump -Htv


How do I determine the amount of paging space allocated and in use?

Type the following:

lsps -a


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:
smtctl [ -m off | on [ -w boot | now]]

The following options are available:

-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.

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 to create a volume group?

Use the following command, where s partition_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 5.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.


mkvg -y name_of_volume_group -s partition_size list_of_hard_disks


How do I create a logical volume?

Type the following:


mklv -y name_of_logical_volume name_of_volume_group number_of_partition


Queries about volume groups

To show volume groups in the system, type:

lsvg


To show all the characteristics of rootvg, type:

lsvg rootvg


To show disks used by rootvg, type:

lsvg -p rootvg


How to add a disk to a volume group?

Type the following:


extendvg VolumeGroupName hdisk0 hdisk1 ... hdiskn


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 256 KB.


/usr/sbin/lquerypv -M hdisk0
256


You can also run the lspv command on the hard disk and look at the value for MAX REQUEST.

How do I replace a disk?

extendvg VolumeGroupName hdisk_new
migratepv hdisk_bad hdisk_new
reducevg -d VolumeGroupName hdisk_bad
How do I mirror a logical volume?

mklvcopy LogicalVolumeName Numberofcopies
syncvg VolumeGroupName
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.


alt_disk_copy -d 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.


Back to top

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.


Back to top

Resources

Participate in the discussion forum.


The IBM eServer pSeries and AIX Information Center provides the latest documentation on the AIX.


Visit the Developer Bookstore for a comprehensive listing of technical books, including hundreds of eServer? titles.


Want more? The developerWorks eServer zone hosts hundreds of informative articles and introductory, intermediate, and advanced tutorials on the eServer brand.


Get involved in the developerWorks community by participating in developerWorks blogs.


The IBM developerWorks team hosts hundreds of technical briefings around the world which you can attend at no charge.


Back to top

About the author

Shiv Dutta works as a Technical Consultant in the IBM Systems and Technology Group where he assists independent software vendors with the enablement of their applications on pSeries servers. Shiv was one of the co-authors of AIX 5L Differences Guide Version 5.3 Edition redbook and has considerable experience as a software developer, system administrator, and an instructor. He provides AIX support in the areas of system administration, problem determination, performance tuning, and sizing guides. Shiv has worked with AIX from its inception. He holds a Ph.D. in Physics from Ohio University and can be reached at sdutta@us.ibm.com.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/17252115/viewspace-748455/,如需轉載,請註明出處,否則將追究法律責任。

相關文章