Warning: Cannot modify header information - headers already sent by (output started at /data/web/virtuals/85063/virtual/www/domains/waldauf.org/lib/plugins/color/syntax.php:1) in /data/web/virtuals/85063/virtual/www/domains/waldauf.org/inc/actions.php on line 180
linux:aix:tips - WiKi
Table of Contents




Command About
mail -f /absolute/path/mbox Read mailbox (Message: You have [unread] mail)
smitty System manager
errpt Generates a report of logged errors.
errpt -aj IDENTIFIER Displays information about errors in the error log file in detailed format.

Command About
lscfg Displays configuration, diagnostic, and vital product data (VPD) information about the system including CPU information.
lsattr -E -l proc0 | grep “Processor Speed” Returns the processor speed in hertz (Hz).
pmcycles Command lists the processor speed.
vmstat 10 10 Determine the cpu usage (user/sys/idle/wait).
uptime Determine the load of your system.

Command About
lsps -a Determine the memory/swap usage of an AIX system
svmon Determine the memory/swap usage of an AIX system
nmon + m key Show memory usage.
topas + M key Show memory usage.

Work with files
Command About
tar cvf - whatever | gzip -c > myfile.tar.gz Create compressed tar.gz file.
gzip -c myfile.tar.gz | tar xvf - Uncompress tar.gz file.
rmfs [-r] /mymount Remove mount point entryand the LV for/mymount.
Add -r to remove mount point.
chfs -a size=+1G /var Grow the/var filesystemby 1 Gig.
chfs -a size=1G /var Grow the/var filesystem to 1 Gig.
du -smx / Find the file usage on a filesystem.
lsfs List filesystems in agrep-able format.
mklv -t jfs2log -y datalog1 datavg 1 Create a log device ondatavg VG.
logform /dev/datalog1 Format the log device just created.
logform /dev/datalv1 Format the log device associated with the fs on LV datalv1.


Default rootvg filesystems hd1 - /home hd2 - /usr hd3 - /tmp hd4 - / hd5 - Boot logical volume hd6 - paging space hd8 - log device hd9var - /var hd10opt - /opt

Kernel Tuning
no Is used in the following examples. vmo, no, nfso, ioo, raso, and schedoall use similar syntax.
no -D Reset all networking tunables to the default values.
Changed values will be listed.
no -a List all networking tunables.
no -o use isno=1 Set a tunable temporarily (until reboot).
no -r -o use isno=1 Set a tunable at next reboot.
no -p -o use isno=1 Set current value of tunable as well as reboot.
no -L List all settings, defaults, min, max, and next boot values.
lsattr -El sys0 List all sys0 tunables.
chdev -l sys0 -a maxuproc=2048 Change the maximum number of user processes to 2048.
smtctl Check to see if SMT is enabled.

PdDv, PdAt, PdCn - Predefined Databases
CuDv, CuAt, CuDep, CuDvDr, CuVPD - Customized Databases
odmget -q name=hdisk0 CuDv Query CuDv for a specific item.
odmget -q “name like hdisk?” CuDv Query CuDv using the “like” syntax.
odmget -q “name like hdisk? and parent like vscsi?” CuDv Query CuDv using a complex query.

lsdev List all devices on a system.
Device states are: Undefined; Supported Device, Defined; Not usable (once seen), Available; Usable
lsdev -Cc disk List all disk devices on a system (Some other devices are: adapter, driver, logical volume, processor)
lsdev -C -r class List all customized (existing) device classes (-P for complete list)
rmdev -dl hdisk5 Remove hdisk5
getconf DISK DEVNAME hdisk1or bootinfo -o hdisk1 Get device address of hdisk1
getconf DISK SIZE hdisk1or bootinfo -s hdisk1 Get the size (in MB) of hdisk1
lsslot -c pci -l ent0 Find the slot of a PCI Ethernet adapter.
lscfg -l ent1 Find the (virtual) location of an Ethernet adapter.
lscfg Find the location codes of all devices in the system.
lspath -l hdisk0 List all MPIO paths for hdisk0.
lscfg -vl fcs0 | grep Network Find the WWN of the fcs0 HBA adapter.
swcons /console.out(Use swconsto change back.) Temporarily change console output to/console.out.

Command About
ps auxwww [PID] Full listing of running processes.

Command About

Change port type of (a 2Gb) HBA(4Gb may use different setting)

rmdev -d -l fcnet0 rmdev -d -l fscsi0 chdev -l fcs0 -a link type=pt2pt cfgmgr Mirroring rootvg to hdisk1

extendvg rootvg hdisk1 mirrorvg rootvg bosboot -ad hdisk0 bosboot -ad hdisk1 bootlist -m normal hdisk0 hdisk1 Mount a CD ROM to /mnt mount -rv cdrfs /dev/cd0 /mnt Create a VG, LV, and FS, mirror, and create mirrored LV

mkvg -s 256 -y datavg hdisk1(PP size is 1/4 Gig) mklv -t jfs2log -y dataloglv datavg 1 logform /dev/dataloglv mklv -t jfs2 -y data01lv datavg 8(2 Gig LV) crfs -v jfs2 -d data01lv -m /data01 -A yes extendvg datavg hdisk2 mklvcopy dataloglv 2(Note use of mirrorvg in next example) mklvcopy data01lv 2 syncvg -v datavg lsvg -l datavgwill now list 2 PPs for every LP mklv -c 2 -t jfs2 -y data02lv datavg 8(2 Gig LV) crfs -v jfs2 -d data02lv -m /data02 -A yes mount -a Move a VG from hdisk1 to hdisk2

extendvg datavg hdisk2 mirrorvg datavg hdisk2 unmirrorvg datavg hdisk1 reducevg datavg hdisk1 Find the free space on PV hdisk1 lspv hdisk1(Look for “FREE PPs”) Users and Groups List all settings for root user ingrepable format lsuser -f root Listjust the user names lsuser -a id ALL | sed ’s/ id.*$’ Find the fsize value for user wfavorit lsuser -a fsize wfavorit Change the fsize value for user wfavorit chuser fsize=-1 wfavorit Networking •The examples here assume that the default TCP/IP configuration (rc.net) method is used. If the alternate method of usingrc.bsdnet is used then some of these examples may not apply. Determine ifrc.bsdnet is used overrc.net lsattr -El inet0 -a bootup option TCP/IP related daemon startup script /etc/rc.tcpip To view the route table netstat -r To view the route table from the ODM DB lsattr -EHl inet0 -a route Temporarily add a default route route add default Temporarily add an address to an interface ifconfig en0 netmask Temporarily add an alias to an interface ifconfig en0 netmask alias To permanently add an IP address to the en1 interface chdev -l en1 -a netaddr= -a netmask=0xffffff00 Permanently add an alias to an interface chdev -l en0 -a alias4=, Remove a permanently added alias from an interface chdev -l en0 -a delalias4=, List ODM (next boot) IP configuration for interface lsattr -El en0 Permanently set the hostname chdev -l inet0 -a hostname=www.tablesace.net Turn on routing by putting this inrc.net no -o ipforwarding=1 List networking devices lsdev -Cc tcpip List Network Interfaces lsdev -Cc if List attributes of inet0 lsattr -Ehl inet0 List (physical layer) attributes of ent0 lsattr -El ent0 List (networking layer) attributes of en0 lsattr -El en0 Speed is found through the entX device lsattr -El ent0 -a media speed Set the ent0 link to Gig full duplex (Auto Negotiation is another option) chdev -l ent0 -a media speed=1000 Full Duplex -P Turn off Interface Specific Network Options no -p -o use isno=0 Get (long) statistics for the ent0 device (no -d is shorter) entstat -d ent0 List all open, and in use TCP and UDP ports netstat -anf inet List all LISTENing TCP ports netstat -na | grep LISTEN Remove all TCP/IP configuration from a host rmtcpip IP packets can be captured usingiptrace /ipreport ortcpdump ^Error Logging ^| | Error logging is provided through: alog, errlog and syslog. | | | alog -o -t boot | Display the contents of the boot log. | | alog -o -t console | Display the contents of the console log. | | alog -L | List all log types thatalog knows. | | errlogger “Your message here” | Send a message to errlog. | | errpt (Add -aor -Afor varying levels of verbosity) | Display the contents of the system error log. | | | | | | | | | | | Errors listed from errpt can be limited by the -d S or -d H options. S is software and H is hardware. Error types are (P)ermanent, (T)emporary, (I)nformational, or (U)nknown. | | | Error classes are (H)ardware, (S)oftware, (O)perator, or (U)ndetermined. | | | errclearx | Clear all errors up untilx days ago.. | | errpt -aDj FE2DEE00 | List info on error IDFE2DEE00 (IDENTIFIER column inerrpt output). | | errpt -c | Put a “tail” on the error log. | | errpt -s ‘date +%m%d0000%y‘ | List all errors that happened today. | | errpt -N hdisk0 | To list all errors on hdisk0. | | /usr/lib/errdemon -l | To list details about the error log. | | /usr/lib/errdemon -s 2097152 | To change the size of the error log to 2 MB. | | smitty FastPaths | Find a smitty FastPath by walking through the smitty screens to get to the screen you wish. Then Hit F8. The dialog will tell you what. | FastPath will get you to that screen. (F3 closes the dialog.) lvm - LVM Menu mkvg - Screen to create a VG configtcp - TCP/IP Configuration eadap - Ethernet adapter section fcsdd - Fibre Channel adapter section chgsys - Change / Show characteristics of OS users - Manage users (including ulimits) devdrpci - PCI Hot Plug manger etherchannel - EtherChannel / Port Aggregation System Resource Controller Start the xntpd service startsrc -s xntpd Stop the NFS related services stopsrc -g nfs Refresh the named service refresh -s named List all registered services on the system lssrc -aShow status of ctrmcsubsystem lssrc -l -s ctrmc Working with Packages List all files in bos.games fileset. lslpp -f bos.games Find out what fileset “fortune” belongs to. lslpp -w /usr/games/fortune List packages that are above the current OS level oslevel -g Find packages below a specified ML oslevel -rl 5300-05 List recommended MLs oslevel -rq List installed MLs instfix -i | grep AIX ML List all filesets lslpp -L List all filesets in agrepable orawkable format lslpp -Lc Find the package that contains the filemon utility which fileset filemon Install the database (from CD) forwhich fileset installp -ac -d /dev/cd0 bos.content list Create a mksysb backup of the rootvg volume group mksysb -i /mnt/server1.mksysb.‘date +%m%d%y‘ Cleanup after a failed install installp -C LV M Put a PVID on a disk chdev -l hdisk1 -a pv=yes Remove a PVID from a disk chdev -l hdisk1 -a pv=clear List all PVs in a system (along) with VG membership lspv Create a VG called datavg using hdisk1 using 64 Meg PPs mkvg -y datavg -s 64 hdisk1 Create a LV on (previous) datavg that is 1 Gig in size mklv -t jfs2 -y datalv datavg 16 List all LVs on the datavg VG lsvg -l datavg List all PVs in the datavg VG lsvg -p datavg Take the datavg VG offline varyoffvg datavg Remove the datavg VG from the ODM exportvg datavg Import the VG on hdisk5 as datavg importvg -y datavg hdisk5 Vary-on the new datavg VG (can useimportvg -n) varyonvg datavg List all VGs (known to the ODM) lsvg List all VGs that are on line lsvg -o Check to see if underlying disk in datavg has grown in size chvg -g datavg Move a LV from one PV to another migratepv -l datalv01 hdisk4 hdisk5 Delete a VG by removing all PVs with thereducevg command. reducevg hdisk3(-dremoves any LVs that may be on that PV) Memory / Swapfile List size, summary, and paging activity by paging space lsps -a List summary of all paging space lsps -s List the total amount of physical RAM in system lsattr -El sys0 -a realmem Create a new paging device on rootvg of 64 PPs mkps -a -s 64 -n rootvg topasOptions Make topas look liketop topas -P View statistics from other partitions topas -CView statistics for disk I/O topas -D Show statistics related to micro-partitions in Power5 environment topas -L All of the above commands are availible from withintopas Performance Monitoring Usempstat -d to determine processor affinity on a system. Look for s0 entries for the best affinity and lesser affinity in the higher fields. Get verbose disk stats for hdisk0 every 2 sec iostat -D hdisk0 2 Get extended vmstat info every 2 seconds while [ 1 ]; do vmstat -vs; sleep 2; clear; done Get running CPU stats for system mpstat 1 Get time based summary totals of network usage by process netpmonto start statistics gathering, trcstopto finish and summarize. Getting info about the system Find the version of AIX that is running oslevel List all attributes of system getconf -a Find the type of kernel loaded (use -a to get all options) getconf KERNEL BITMODE bootinfo and getconf can return much of the same information, getconf returns more and has thegrepable -a option. Find the level of firmware on a system invscout List all attributes for the kernel “device” lsattr -El sys0 Print a “dump” of system information prtconf Display Error Codes 214,2C5,2C6,2C7,302,303,305 - Memory errors 152,287,289 - Power supply failure 447 - An error has occurred on an adapter 521 - init process has failed 551,552,554,555,556,557 - Corrupt LVM, rootvg, or JFS log 553 - inittab or /etc/environment corrupt 552,554,556 - Corrupt filesystem superblock 521 through 539 -cfgmgr (and ODM) related errors 532,558 - Out of memory during boot process 518 - Failed to mount/var or/usr 615 - Failed to config paging device More information is availible in the “Diagnostic Information for Multiple Bus Systems” manual Additional Information http://publib16.boulder.ibm.com/pseries/en US/infocenter/base About this QuickSheet Created by:William Favorite (wfavorite@tablespace.net) Updates at:http://www.tablespace.net Disclaimer:This document is a guide and it includes no express war- ranties to the suitability, relevance, or compatibility of its contents with any specific system. Research any and all commands that you inflict upon your command line. Distribution:The PDF version is free to redistribute as long as credit to the author and tablespace.net is retained in the printed and viewable versions. LATEXsource not distributed at this time ===== WEB pages ===== * AIX forum * AIX commands you should not leave home without