AIX Misc Commands

root's picture

How to list the records from /var/adm/wtmp file:

gz@aix# last
Another way is to manipulate directly the file with fwtmp command as follows:
# /usr/lib/acct/fwtmp < /var/adm/wtmp | more

How to show the shutdown sessions:

gz@aix# last | grep shutdown

How to show how long the system has been up:

gz@aix# uptime
gz@aix# w -u

How to enter the entry tty002:23:respawn:/usr/sbin/getty /dev/tty in inittab:

gz@aix# chitab tty002:23:respawn:/usr/sbin/getty /dev/tty

How to list the operating system level:

gz@aix# oslevel

How to see the number of license:

gz@aix# lslicense

How to change the fixed user license to 30:

gz@aix# chlicense -u30

How to enable floating user license:

gz@aix# chlicense -f on

How to display complete summary of report (how to show all errors and events):

gz@aix# errpt

How to list complete detailed report (how to show all errors and events in detailed view):

gz@aix# errpt -a

How to list all hardware related errors:

gz@aix# errpt -d H

How to list all software related errors:

gz@aix# errpt -d S

How to list detailed error report of error id 88965309:

gz@aix# errpt -a -j 88965309

How to list all events for which reporting is currently disabled:

gz@aix# errpt -t -F Report=0

How to disable the reporting of the ERRLOG_OFF event (error ID 192AC071):

gz@aix# errupdate <Enter>
=192AC071: <Enter>
Report=False <Enter>
<Ctrl-D>
<Ctrl-D>

Example:

gz@aix# errpt -t -F Report=0  
Id       Label               Type CL Description
1850F542 MINIDUMP_INFO       INFO O  NVRAM WAS RE-INITIALIZED
45E4E066 DUPCHECK_OFF        TEMP O  Duplicate checking turned off
86DC0701 DUPCHECK_ON         TEMP O  Duplicate checking turned on
B0787F02 NVRAM_ERRDATA       UNKN U  CORRUPT DATA DETECTED
gz@aix# errupdate
=BFE4C025:
Report=False
0 entries added.
0 entries deleted.
1 entries updated.
gz@aix# errpt -t -F Report=0  
Id       Label               Type CL Description
1850F542 MINIDUMP_INFO       INFO O  NVRAM WAS RE-INITIALIZED
45E4E066 DUPCHECK_OFF        TEMP O  Duplicate checking turned off
86DC0701 DUPCHECK_ON         TEMP O  Duplicate checking turned on
B0787F02 NVRAM_ERRDATA       UNKN U  CORRUPT DATA DETECTED
[color=green]BFE4C025 SCAN_ERROR_CHRP     PERM H  UNDETERMINED ERROR[/color]

How to enable the reporting of the ERRLOG_OFF event (error ID 192AC071) in case it was turned off:

gz@aix# errupdate <Enter>
=192AC071: <Enter>
Report=True <Enter>
<Ctrl-D>
<Ctrl-D>

How to delete the ERRLOG_OFF event (error ID 192AC071) from the Error Record Template Repository:

gz@aix# errupdate <Enter>
-192AC071:
<Ctrl-D>
<Ctrl-D>

How to add an entry to the errorlog:

gz@aix# /usr/bin/errlogger "The desired message"

How to dispay the HMC information (hmc ip is on HostName field of "resource N" stanza):

gz@aix# lsrsrc "IBM.ManagementServer"
or
gz@aix# lsrsrc IBM.MCP

Sometimes you may get error on the above command, like:
/usr/sbin/rsct/bin/lsrsrc-api: 2612-010 Resource class IBM.ManagementServer is not defined.[/code]
In this case, you can search for the hostname or ip of hmc in the file:
/var/ct/cfg/ctrmc.acls

How to list partition information:

gz@aix# lparstat -i
gz@aix# lsattr -El sys0

How to display the processors available in the partition:

gz@aix# bindprocessor -q

How to turn off SMT:

gz@aix# smtctl -m off

How to turn on SMT:

gz@aix# smtctl -m on

How to display SMT configuration:

gz@aix# smtctl

How to set the number of hardware threads per core:

gz@aix# smtctl -t N

How to turn on SMT:

gz@aix# smtctl -m on

Details volume group info for the hard disk:

gz@aix# lqueryvg -Atp /dev/hdisk

Find a file after the inode number:

gz@aix# find /usr -xdev -inum INODE -print
gz@aix# ncheck -i INODE /dev/hd2 <- warning: the path starts with the FS (eg /usr/bin/ksh = /bin/ksh in our example)

How to list the kernel processes:

gz@aix# ps -ekl

How to list the threads of a given process:

1. get the pid of sshd (for example):
gz@aix# ps -ef|grep sshd
2. list the threads of sshd process:
gz@aix# ps -lmp <PID>

How to get the serial number of a vio disk from the lpar client (DS disk in this example):

gz@aix# odmget CuAt | grep -p hdisk25 | grep -p "unique_id" | grep value
        value = "2343243243243[color=red]75992817EE8[/color]07210790003IBMfcp05VDASD03AIXvscsi"

or better,
for DS disks:

gz@aix# odmget -q "name=hdisk0 and attribute=unique_id" CuAt | awk '/value/ {print substr($3,14,11)}'
75992817EE8

for SVC disks:

gz@aix# odmget -q "name=hdisk0 and attribute=unique_id" CuAt | awk '/value/ {print substr($3,11,32)}'
6005076801810514A800000000000853

How to check the error log size:

gz@aix# /usr/lib/errdemon -l

How to display the current control key settings:

gz@aix# stty -a

How to put a system in maintenance mode without reboot:

gz@aix# telinit m

HMC Led Codes:

0c54 = An AIX install is in progress
0552 = varyon of the root volume group failed
0c31 = waiting for user to define console type vty0

How to get the last modification date of a file:

gz@aix# $ istat loop.pl
Inode 120 on device 10/8        File
Protection: rwxr-xr-x   
Owner: 205(florian)             Group: 1(staff)
Link count:   1         Length 74 bytes

Last updated:   Tue May 15 03:55:23 2012
Last modified:  Tue May 15 03:55:23 2012
Last accessed:  Tue May 15 04:06:31 2012

How to show terminal name:

gz@aix# tty

How to apply the changes made to the inittab file without a system reboot:

gz@aix# init q

How to check the size of memory:

#bootinfo -r
or
prtconf -m

How to use keyboard shortcuts in AIX terminal:

Backspace : to correct mistakes.
<ctrl+c> : terminates the correct command and return to the shell.\
<ctrl+d> : end of transmission or end of file
<ctrl+s> : temporary stops the output to the screen
<ctrl+q> : resumes output which was stopped by ctrl+s
<ctrl+u>: erases the entire line.

Thou shalt not steal!

If you want to use this information on your own website, please remember: by doing copy/paste entirely it is always stealing and you should be ashamed of yourself! Have at least the decency to create your own text and comments and run the commands on your own servers and provide your output, not what I did!

Or at least link back to this website.

Recent content

root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root