IBM’s useful commands listing

Memory

  • bootinfo –r shows how much RAM does my machine has (as root)
  • lsattr –E –l sys0 –a realmem shows how much RAM does my machine have (as non root)
  • rmss -c 512 sets the memory size to 512 MB
  • rmss -r resets the memory size to the original one

Devices

  • powermt display lists errors etc for fibre cards
  • lsattr -El en0 displays en0 driver params
  • lsattr -El ent0 displays ent0 HW params
  • lsattr -El rmt0 displays tape params
  • lscfg -vp -l rmt0 all information about a tape drive
  • lsattr -El sys0 displays system type, firmware, etc driver params
  • lscfg –v lists all system HW config (NVRAM)
  • lsdev –Csscsi list all scsi devices
  • lsdev –Cspci list all pci devices
  • lsparent –Ck scsi list all scsi adapters
  • lsdevfc list fiberchannel devices
  • cfgmgr Configures devices
  • lsdev -Ccdisk Shows all disks
  • lsdev -Cctape Shows all tapes
  • cfgmgr -v -l device –v Specifies verbose output. The cfgmgr command writes information about what it is doing to standard output.
  • cfgmgr -v -l device Name Specifies the named device to configure along with its children. If you only turned on a disk tower at e.g. scsi2 cfgmgr -v -l scsi2 will only configure this with detailed output.
  • lsdisp To check which graphic adapter is installed.
  • lscfg -vp -l mga0 (all information about a adapter)
  • lscfg -vp -l hdisk0 | grep Machine gives info about the disk manufacture type
  • lsslot -c pci For 6F1 only !!!! Lists all slots ,voltage,boards,etc !!!!
  • bootlist -m normal cd0 rmt0 hdisk0 Changes the default bootlist
  • lsmcode -c display the system firmware level and service processor
  • lsmcode -r -d scraid0 display the adapter microcode levels for a RAID adapter scraid0
  • lsmcode -A display the microcode level for all supported devices

System info

  • /usr/bin/uname -m Get machine ID
  • /usr/bin/uname -M Get platform type
  • oslevel Displays current AIX level
  • oslevel -r Displays current AIX maintenance level
  • oslevel -g List filesets at levels later than maintenance level !!!
  • lsps -a Paging space settings
  • lscfg -vp -l proc0 (1,2,3) (all information about a processor[s])
  • lscfg -vp -l mem0 |pg all information about memory modules installed
  • env ulimit Environment settings – show user ulimit
  • bootinfo –s hdisk0 Displays disk size
  • lsattr -El sys0 -a systemid Determines the system serial number
  • lscfg –vp|grep ROM|grep -v CD Determines the system Firmware level

System issues

  • TERM=vt100 Run this if you execute a command/application and it responds with message ‘The type of your terminal is unknown to the system’. In ‘ksh’ and tcsh set term=vt100
  • dd if=/dev/fd0 of=/tmp/diskimage bs=4096 Duplicate a diskette copy from diskette to hard drive
  • dd if=/tmp/diskimage of=/dev/fd0 bs=4096 copy diskette image onto diskette
  • /usr/lpp/X11/bin/xset -display unix 0 s off Kill display timeout
  • lsfs -v jfs List of Filesystem items.
  • lsfs -q -v jfs You can see also the parameter of a filesystem and thus see if e.g. /backup was or is a big_filesystem_enabled one. Important for the 2GB File limit.
  • lsuser –f root Shows all user parameters (max .file size,etc)
  • sysdumpdev -L Check last system dump status
  • sysdumpdev -l Check system dump device settings
  • lslpp -f Upd_Timna_DTM.obj List contents of package

Networking

  • netstat -i displays network interfaces setting
  • mktcpip -S en0 dumps all TCPIP information for the interface in compact format
  • showmount –e displays all exported volumes
  • showmount -a show who’s got my filesystemsses mounted over IP
  • lssrc –g tcpip displays all IP oriented processes status
  • entstat -drt ent0 |grep –i error display any communication errors on ent0
  • entstat -r Resets all the statistics back to their initial values.
  • arp -a shows a local arp cache
  • netstat -ptcp shows IP statistics
  • netstat -pudp shows UDP statistics
  • netstat -I en0 10 Trace en0 every 10 seconds
  • netstat -rn Display routing info with IP address
  • netstat -in Shows the state of all configured interfaces
  • netstat -r Display routing info with full hostnames
  • nfsstat –z Reset NFS stats without reboot
  • mount hostname:/filesystem /mount-point Mount an NFS filesystem
  • mknfsexp -d /directory Creates an NFS export directory
  • mknfsmnt Creates an NFS mount directory
  • rmnfs Stops and un-configures NFS services
  • mknfs Configures and starts NFS services
  • exportfs Lists all exported filesystems
  • exportfs -a Exports all fs’s in /etc/exports file
  • exportfs -u filesystem Un-exports a filesystem

Disks

  • synclvodm -vP vgname synchronizes ODM and the disk VG info.
  • redefinevg vgname Redefine VG definition in ODM to resync LVM and ODM definitions
  • lqueryvg -p hdisk0 –Avt Reads logical volumes info from disk
  • bootinfo -s hdisk0 Shows Megabytes available even if no volume group is assigned.
  • lspv -p hdisk0 PP’s used, location on disk, mount point
  • lscfg -vp -l hdisk0 all information about a disk/raid

Filesystem

  • fuser -k /dev/cd0 Releases a CD that is being held open by a process
  • fuser –c /some/filesystem Find out which PID is holding open the filesystem
  • istat filename Shows when the file was last created/modified/accessed

System monitoring

  • istat filename Shows create/modify/access file info
  • alog -o -t boot displays system boot log
  • last –20 Shows last 20 logins
  • history Last commands run on the system by this user

Performance issues

  • sar –P ALL 2 2 Show all CPU’s activity on an SMP machine
  • svmon –i 2 Monitors real and virtual memory
  • ps auxw | sort –r +3 |head –10 Shows top 10 memory usage by process
  • ps auxw | sort –r +2 |head –10 Shows top 10 CPU usage by process
  • ps –auw | grep defunct Shows zombies processes (to kill – reboot or kill the parent)
  • filemon –O all –o filemon.out ; find / -name core ; trcstop Traces FS,LV,disks,files activity of a “find” command into a logfile (filemon.out). Must be preceded by a trcstop command.
  • tprof –x find / -name core ; trcstop Traces CPU activity of a “find” command. Several logfiles are created. Must be preceded by a trcstop command.
  • tprof -ske -x “sleep 30” Trace CPU activity for next 30 seconds. Results in file sleep.tprof.
  • lvmstat –ev vgname Enable lvmstat tracing on VG vgname
  • lvmstat –v vgname 2 Display LVM stats every 2 seconds on VG vgname
  • lvmstat -dv vgname Disable lvmstat tracing on VG vgname

Remote issues (working over the modem)

  • pdelay tty0; pdisable tty0 >/dev/null ;penable tty0 Resets tty0
  • stty erase ‘^?’ Makes backspace work if backspace is DEL
  • stty erase ‘^H’ Makes backspace qork if backspace is CTRL-H
  • kermit -l /dev/ttyx –c atdt phone# Use Unix to dial out using the modem on serial port ttyx
  • kermit -s /some/file -i Sends a file to a remote instance of kermit in binary mode
  • kermit –r Receives a file from a remote instance of kermit

Browsing errlog with errpt

  • errpt -a -s 0604090601 -e 0605090901 browse the errlog in detail for all errors within a timeframe
  • errpt -a -N SYSPROC List error logs for the SYSPROC resource
  • errpt -j 5DFED6F1 Browse the errlog by the identifier
  • errpt –A Shows fewer details then errpt -a
  • errpt –D Eliminates double entries

Security issues

  • chmod -s filename Remove suid (“sticky”) bit to a file or directory
  • chmod +r+w+x+t filename Add Read+Write+Execute+Temp mode to a file or directory. This is a ‘blanket’ change for all owner, user & group, otherwise:
Numeric Access Modes  
0 (---) - no access
1 (--x) - execute permissions; search permissions for directories
2 (-w-) - write access
3 (-wx) - execute/search permission and write access
4 (r--) - read access
5 (r-x) - execute/search permission and read access
6 (rw-) - read and write access
7 (rwx) - execute/search permission and read and write access
  • mkpasswd -f rebuild the /etc/passwd indexes in case of suspected corruption