Monday, September 12, 2011

AIX Useful commands

For my own references

Commands for memory

shows how much RAM does my machine has (as root)
bootinfo –r 
shows how much RAM does my machine have (as non root)
lsattr –E –l sys0 –a realmem

Simulates a system with various sizes of memory for performance testing of applications.

To set the memory size to 512 MB
rmss -c 512
To reset the memory size to the original one
rmss -r 

Commands for Disk / file system

Shows all disks
lsdev -Ccdisk
Gives info about the disk manufacture type
lscfg -vp -l hdisk0 | grep Machine
Displays disk size (even if no volume group is assigned)
bootinfo –s hdisk0
Displays information about a physical volume within a volume group (Display PP's used, location on disk, mount point)
lspv -p hdisk0
List of Filesystem items of jfs2 file system type.
lsfs -v jfs2  
List the parameter the filesystem of jfs2 file system type
lsfs -q -v jfs2

From here, we can see if e.g. /backup was or is a big_filesystem_enabled one. Important for the 2GB File limit.

Displays all exported volumes
showmount –e    
Show who's got my file systems mounted over IP !
showmount -a
Shows all mounted filesystems (nfs+local)
mount
Synchronize the device configuration database (ODM) with the logical volume manager information for rootvg
synclvodm -vP rootvg
Redfined VG definition in ODM
redefinevg rootvg
Reads logical volumes info from disk
lqueryvg -p hdisk0 –Avt  
Increases /var FS by about 100MB (each unit is 512 bytes)
chfs -a size=+200000 /var
Mounts all FS stated in /etc/filesystems
mount all
Unmounts a FS
umount /mnt/
Identifies processes using a file or file structure
fuser –c /dataVolumes/test
Releases a CD that will not unmount by sending SIGKILL signal to each local process. Must be root.
fuser -k /dev/cd0
Shows when the file was last created/modified/accessed
istat 
Reports input/output statistics for logical partitions, logical volumes and volume groups every 2 seconds
lvmstat –v hd2 2
Enable / Disable LVM statistic collection
lvmstat -e hd2

lvmstat -d hd2

Commands for Network

Displays en0 driver params
lsattr  -El  en0
Displays ent0 Hardware params
lsattr  -El  ent0
Display specific device specified by logical name ent0
lscfg  -v -l ent0
Display firmware device tree for the corresponding node to the ent0 device
lscfg -vp -lent0
Displays en0 driver params
ifconfig en0
Displays network interfaces setting
netstat  -i
Display all interface information - host:addr:mask:_rawname:nameserv:domain:gateway:cost:activedgd:type:start
for i in `lsdev | grep en | grep "Standard Ethernet" | awk '{print $1}'`; do echo Checking $i;mktcpip -S $i; done
Displays all IP oriented processes status
lssrc –g tcpip
Display any communication errors on ent2
entstat -drt ent2 |grep –i error
Resets all the statistics back to their initial values.
entstat -r
Shows a local arp cache
arp -a
Shows IP statistics
netstat  -ptcp
Shows UDP statistics
netstat  -pudp
Show network buffer cache statistic
netstat  -c
Show network statistic for each protocol
netstat  -s
Shows statistics recorded by the memory management routines
netstat -m
Trace en2 every 3 seconds
netstat -I en2 3
Ping with displaying the routing info
ping -R -c 1 myserver
Display routing info
netstat -rn
Shows the state of all configured interfaces
netstat -in
Display routing info with full hostnames
netstat -r
Trace all hobs (interconnections=routers) to the destination IP
traceroute 149.115.39.1

Monitors activity and reports statistics on network I/O and network-related CPU usage.

To start
netpmon -o netpmon.out
To Stop
trcstop
Displays a fully qualified domain name of a host
namerslv -s | grep domain | awk '{ print $2 }'
Shows the status of a remote host on the local network
rup myserver

Commands for Tape Device

Displays tape params
lsattr -El rmt0
all information about a tape drive
lscfg -vp -l rmt0
Shows all tapes lsdev -Cctape

Commands for NFS

Resets NFS stats without reboot
nfsstat  –z
To stop / start NFS services on a client
stopsrc –g NFS

startsrc –g NFS
Mount an NFS filesystem
mount hostname:/filesystem /mount-point
Exports a directory to NFS clients
mknfsexp -d /directory
Mounts a directory from an NFS server
mknfsmnt
Changes the configuration of the system to stop running NFS daemons
rmnfs 
Configures the system to run NFS
mknfs
Un-exports a filesystem
exportfs -u (filesystem)
Lists all exported filesystems
exportfs
Exports all directories listed in /etc/exports file
exportfs -a

Commands for Devices

Displays system type, firmware, etc driver params
lsattr  -El  sys0
Lists all system HW config (NVRAM)
lscfg –v
List all scsi devices
lsdev –Csscsi
List all pci devices
lsdev –Cspci
List all scsi adapters
lsparent –Ck scsi
List fiberchannel devices
lsdevfc
Configures devices
cfgmgr
This is similar to devfsadm in Solaris Specifies verbose output. The cfgmgr command writes information about what it is doing to standard output.
cfgmgr -v -l device –v
Name Specifies the named device to configure along with its children.
cfgmgr -v -l device
If you only turned on a disk tower at e.g. scsi2 cfgmgr -v -l scsi2 will only configure this with detailed output.

Commands for Graphic adapter

To check which graphic adapter is installed.
lsdisp
List all information about a adapter
lscfg -vp -l mga0

Commands for boot

Change the default bootlist
bootlist -m normal cd0  rmt0 hdisk0

Commands for Firmwares

Display the system firmware level and service processor
lsmcode -c
Display the adapter microcode levels for a RAID adapter scraid0
lsmcode -r -d scraid0
Display the microcode level for all supported devices
lsmcode -A

Commands for System Information

Get machine ID
/usr/bin/uname -m
Get platform type
/usr/bin/uname -M
Determines the system serial number
lsattr -El sys0 -a systemid | awk '{print $2}' | awk -F, '{print $2}'
Displays current AIX level
oslevel
Displays current AIX maintenance level
oslevel -r
List filesets at levels later than maintenance level !!!
oslevel -g
List all information about a processors
lscfg -vp -l proc0  (1,2,3)   
List all information about memory modules installed
lscfg -vp -l mem0 |pg
Determines the system Firmware level
lscfg –vp|grep ROM|grep -v CD  
Check last system dump status
sysdumpdev -L
Check system dump device settings
sysdumpdev -l
List contents of the package
lslpp -f Upd_Timna_DTM.obj
Shows create/modify/access file info
istat 
Display system boot log
alog -o -t boot | more
Identifies the users currently logged in
who
Shows recent 5 lines
last –5
Shows username ‘root’ login/logout record
last root
Displays local system statistics in interactive mode and records system statistics in recording mode
nmon
The nmon command provides the following views in interactive mode:
    * System resource view (using the r key)
    * Process view (using the t and u keys)
    * AIO processes view (using the A key)
    * Processor usage small view (using the c key)
    * Processor usage large view (using the C key)
    * Shared-processor logical partition view (using the p key)
    * NFS panel (using the N key)
    * Network interface view (using the n key)
    * WLM view (using the W key)
    * Disk busy map (using the o key)
    * Disk groups (using the g key)
    * ESS vpath statistics view (using the e key)
    * JFS view (using the j key)
    * Kernel statistics (using the k key)
    * Long term processor averages view (using the l key)
    * Large page analysis (using the L key)
    * Paging space (using the P key)
    * Volume group statistics (using the V key)
    * Disk statistics (using the D key)
    * Disk statistics with graph (using the d key)
    * Memory and paging statistics (using the m key)
    * Adapter I/O statistics (using the a key)
    * Shared Ethernet adapter statistics (using the O key)
    * Verbose checks OK/Warn/Danger view (using the v key)
    * Detailed Page Statistics (using the M key)
    * Fibre channel adapter statistics (using the ^ key)

Reports selected local and remote system statistics

topas
Monitors system 10 top processes with 2 seconds
monitor -top 10 -s 2
Displays disks activity every 2 seconds refresh interval
iostat 2
Displays the adapter and disk throughput report every 2 seconds
iostat –a 2
Monitors virtual memory statistics every 2 seconds
vmstat 2
Show all CPU’s activity on an SMP machine 2 times separated by 2 seconds.
Each row is for 1 logical processor.
'U' row is for system-wide Unused capacity.
Last line is for system-wide statistics.
sar –P ALL 2 2
Monitors real and virtual memory
svmon –i 2
Shows top 10 memory usage by process
ps auxw | sort –r +3 |head –10  
Shows top 10 CPU usage by process
ps auxw | sort –r +2 |head –10
Traces FS,LV,disks,files activity of a “find” command into a logfile (filemon.out). Must be preceded by a trcstop command.
filemon –O all –o filemon.out ; find / -name core ; trcstop
Traces CPU activity of a “find” command Several logfile are created. Must be preceded by a trcstop command.
tprof –x find / -name core ; trcstop
Shows the DNS server name and address
nslookup hostname
Trace CPU activity for next 30 seconds. Results in file sleep.tprof
tprof -ske -x "sleep 30"

Commands for paging.

Paging space settings.
lsps -a

Commands for user accounts

Environment setings - show user ulimit
env ulimit
Shows all user parameters (max .file size,etc)
lsuser –f root
Lists login users and their programs.
w

Commands to browse errlog

Generates a report of logged errors. Default command
errpt
All details
errpt -a
Moderate details
errpt -A
Eliminates double entries
errpt –D
Browse the errlog in detail for all errors within a timeframe
errpt -a  -s 0604090601  -e 0605090901
where date format is mmddhhmmyy Generates a report of resource names specified by the ResourceNameList variable (SYSPROC)
errpt -a  -N SYSPROC |more
Browse the errlog by the identifier
errpt -j 5DFED6F1
>h4>Misc Find all files containing "10.10.10.13" IP address
ksh
find / -type f|xargs grep "10.10.10.13" 2> /dev/null
Compresses the files while keeps the original
compress -c file > file.Z
Returns full path of program (Similar to 'which' command in Solaris / Linux. Also available in AIX)
whereis  

No comments: