Monday, August 25, 2008

AIX commands quick reference

AIX systems commands

How to make user password never expire ?
Type the following:
# chuser maxage=0 dsusr – passwd never expires

How do I lpar configuration ?
Type the following:
# lparstat –i

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


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 list information about a specific physical volume?
To find details about hdisk1, for example, run the following command:
# lspv hdisk1

How would I know if my machine is CHRP-based?
# lsconf – systeminfo, same as prtconf
# prtconf
# prtconf –m
# prtconf –k
# prtconf -s
Model Architecture: chrp
If it's a CHRP machine, the string chrp (Common Hardware Reference Platform) appears on the Model Architecture line.
Also gives detailed system info.

How would I know if I am running a 32-bit kernel or 64-bit kernel?
# bootinfo –K If the OS is 32/64 bit
# bootinfo –y If the hardware is 32/64 bit
#bootinfo –r Display real memory in KB

How would I know if it is a single core or dual core?
# pmcycles –m
CPU 0 runs at 4208 MHz
CPU 1 runs at 4208 MHz
CPU 2 runs at 4208 MHz
CPU 3 runs at 4208 MHz
CPU 4 runs at 4208 MHz
CPU 5 runs at 4208 MHz
CPU 6 runs at 4208 MHz
CPU 7 runs at 4208 MHz
the Performance Monitor cycle counter and the processor real-time clock to measure the actual processor clock speed in MHz
Number Of Processors: 4
Above result is for 4 processors.


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,
# 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

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.

What version, release, and maintenance level of AIX is running on my system?
Type one of the following:
# oslevel –r

# lslpp –h bos.rte

What SP (Service Pack) is installed on my system?
To see which SP is currently installed on the system,
Sample output for an AIX 5L Version 5.3 system, with TL4, and SP2 installed would be:
# oslevel –s
5300-04-02


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 file systems commands
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:
# crfs -v jfs -g testvg -a size=10M -m /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:
# crfs -v jfs2 -g testvg -a size=10M -p ro -m /fs2


How do I change the size of a file system?
To increase the /usr file system 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 mount a file system?
The following command will mount file system /dev/fslv02 on the /test directory:
# mount /dev/fslv02 /test

How do I remove a file system?
Type the following command to remove the /test file system:
# rmfs /test

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:
# defragfs /home

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 display information about installed filesets on my system?
Type the following:
lslpp -l


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 install an individual fix by APAR?
To install APAR IY73748 from /dev/cd0, for example, enter the command:
instfix -k IY73748 -d /dev/cd0


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


AIX volume groups and logical volumes commands
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 can I change the characteristics of a volume group?
You use the following command to change the characteristics of a volume group:
chvg

How do I create a logical volume?
Type the following:
mklv -y name_of_logical_volume name_of_volume_group number_of_partition


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:
extendlv lv05 3


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:
lsvg -l rootvg

How do I list information about logical volumes?
Run the following command to display information about the logical volume lv1:
lslv lv1

How do I remove a logical volume?
You can remove the logical volume lv7 by running the following command:
rmlv lv7

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:
rmlvcopy testlv 2

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:
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.
What does 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:
syncvg -p hdisk4 hdisk5

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

AIX network commands
How do I identify the network interfaces on my server?
Either of the following two commands will display the network interfaces:
# lsdev -Cc if
# ifconfig -a

How do I activate a network interface?
To activate the network interface tr0, run the command:
# ifconfig tr0 up

How do I deactivate a network interface?
For example, to deactivate the network interface tr0, run the command:
# ifconfig tr0 down



list installed subsystem
#lssrc –a | grep active
If you are updating the subsystem, you need to de-activate it first

Show licensed program installed
#lslpp –l | grep –i ssh list of installed programs
#lslpp –f F-Secure.SSH.Server list of files belong to the license program
# lslpp –l | grep vac check for xlc compiler

#stopsrc –g
#stopsrc –s


#Pwdadm –c

Verifies correctness of user definitions. Runs the following command to fix and report errors:
%usrck -y ALL
%grpck –y ALL
%Pwdck –y ALL

Initab commands
# lsitab -a
# mkitab spid52:2:once:/Quest_Software/Foglight_SPID/startup
# rmitab spid52

sudo commands
# sudo -l -u p139pkg

1 comment:

Anonymous said...

Kool. It was a great help to start