Unix x Command

Embed Size (px)

DESCRIPTION

Unix Command

Citation preview

Sheet1SysinfoDisplay system information i.e cpu, memory, etcMemory and SwapInformation regarding the physical memory and swap areaDisks, Filesystems and DevicesDisplaying disk information, filesystemsNetworkingDisplay and configuring network parametersCrash DumpConfigure, display and use the crash dump utiltitiesPerformance Monitoring and DiagnosticsList, Monitor and trace processesKernel Modules and ParametersDisplaying, modifying and tuning kernel parametersServicesDisplay, start and stop servicesPatching / PackagesInstalling and removing patches and software packagesAccountsSetting up and removing user accountsNFSInformation on NFS i.e starting, stopping, etcNTPNetwork Time ProtocolLog FilesLocation to common log filesSecuritySecurity informationMiscOther stuff i.e shutdown, timezone, run level, etcSysinfoCommand DescriptionSolarisRed HatUbuntu/DebianHP-UXAIXServer Release infocat /etc/releasecat /etc/enterprise-releasecat /etc/lsb-release/stand/kernrelcat /etc/redhat-releaselsb_release -aoslevel -rlsb_release -a

cat /proc/versionServer type/usr/platform/`uname -i`/sbin/prtdiag -vdmidecodedmidecodemodelprtconf | grep -i 'System Model'uname -aHardware Infoprtdiag -vlspcilspciioscanlscfg -vprtpicl -v [-c ]lsusblsusbioscan -fun [disk|tape|lan]lscfg -l ent0prtconf -Dlshallshallscfg -vl fcs0 (find the WWN of HBA adapter)/opt/ignite/bin/print_manifestNote: hal = hardware abstraction layercat /var/opt/ignite/local/manifest/manifest.infolsdevlsdev -Cc disklsdev -Cc disk -p scsi0

lsslot -c [pci|phb|port]lsslot -c pci -l ent0

lspath -l hdisk0

diagOperating Systemuname -auname -auname -auname -aoslevel [-r|-s]Memory/usr/platform/`uname -i`/sbin/prtdiag -vcat /proc/meminfo (detailed)cat /proc/meminfo (detailed)dmesg | grep -i physicalprtconf -mprtconf | grep -i memfree -omfree -om/usr/sam/lbin/getmemprtconf |grep -i memory/opt/ignite/bin/print_manifestlsattr -El sys0 -a realmemcat /proc/slabinfocat /proc/slabinfobootinfo -rcat /var/opt/ignite/local/manifest/manifest.infoCPU (type, number, etc)/usr/platform/`uname -i`/sbin/prtdiag -vcat /proc/cpuinfo (detailed)cat /proc/cpuinfo (detailed)/opt/ignite/bin/print_manifestprtconf |grep -i processorsam -> performance monitors -> system properties## display,offline,onlinepsrinfocat /var/opt/ignite/local/manifest/manifest.infopsradm -f 0 (offline)psradm -n 0 (online)Disk Drivesformatfdisk -lfdisk -lioscan -funC disklsdev -Cc diskprtvtoc sfdisk -l (advanced server)sfdisk -l (advanced server)lsdev -Cc disk -p scsi0 (specific controller)parted printparted printlsdev -Cc disk -S [a|d|s] (available, defined, stopped)format -e (to convert EFI (zfs) to SMI)partprobe -s partprobe lscfg -v -l hdisk0Note:EFI - Extensible Firmware InterfaceSMI - Sun Microsystems IncKernel File and associated directories/kernel/genunix/boot/initrd.?????.img/boot/initrd.img-?????-server/stand/vmunix/unix/boot/vmlinuz/boot/vmlinuz-????-server/platform/sparc/kernel/usr/lib/boot/platform/i86pc/kernel/usr/lib/drivers/kernel/usr/kernelNote: /unix - symbolic link to kernel file i.e /usr/lib/boot/unix_64Kernel 32 or 64isainfo -kv (solaris 9+)uname -auname -agetconf KERNEL_BITS ( version 11)prtconf -kisalist (sparc v9 will be listed first)uname -muname -m/opt/ignite/bin/print_manifest |grep -i 'os mode'bootinfo -Kisainfo -bgetconf -a |grep -i 'long_bit'getconf -a |grep -i 'long_bit'HPUX < version 11 all 32 bit

Note: determine if system supports 64 bitgetconf HW_CPU_SUPP_BITS/opt/ignite/bin/print_manifest |grep -i 'hw capability'

Display FirmwareAt the OK prompt type bannerboot into the BIOS (normally F2 or F12)boot into the BIOS (normally F2 or F12)workstations:prtconf |grep -i firmwarerebootlscfg -pventer PDCinvscouttype: IN (information menu)type: FV (Firmware Version)Display IRQ, IO ports and DMAn/a/proc/interrupts/proc/interruptsn/aprtconf/proc/ioports/proc/ioports/proc/dma/proc/dmaGUI admin tooladmintoollinuxconflinuxconfsamsmitsmitty

Memory and Swap

Command DescriptionSolarisRed HatUbuntu/DebianHP-UXAIXMemory/usr/platform/`uname -i`/sbin/prtdiag -vcat /proc/meminfo (detailed)cat /proc/meminfo (detailed)dmesg | grep -i physicalprtconf -mprtconf | grep -i memfree -omfree -om/usr/sam/lbin/getmemprtconf |grep -i memory/opt/ignite/bin/print_manifestlsattr -El sys0 -a realmembootinfo -rcat /var/opt/ignite/local/manifest/manifest.infopage size (memory)/usr/bin/pagesize/usr/bin/getconf -a| egrep -i 'pagesize|page_size'/usr/bin/getconf -a| egrep -i 'pagesize|page_size'dmesg |grep -i physicalpagesizepagesize -a (display all supported pagesizes)display swapswap -lcat /proc/swaps (detailed)cat /proc/swaps (detailed)swapinfo (displayed in KB)lsps -a (detailed)swap -sswapon -sswapon -sswapinfo -m (display in Mb)lsps -sswapinfo -tm (total / Mb)adding swapmkfile 5m /var/swapfiledevice:device:Create logical volume or filesystemmkps -a -s 4 -n swap -a /var/swapfilecreate partition with fdisk (type 82)create partition with fdisk (type 82)file(create 50MB swap file):file(create 50MB swap file):swapon | -f # change the attributesupdate /etc/vfstabdd if=/dev/zero of=/var/swapfile bs=1024 count=50000dd if=/dev/zero of=/var/swapfile bs=1024 count=50000swapon -p 3 | -f chps -a n paging00 (don't use after restart)

mkswap |mkswap |update /etc/fstab# change the logical volume attributes (name in this case)swapon |swapon |chlv -n (chang page space name)Note: -p = priority swap number . Thenswapdevtunable system parameter controls the maximum number of swap devices.update /etc/fstabupdate /etc/fstabNote:

-a reconfigure paging space after restart-s size of the page space (logical partitions)-n activiates the paging space (use swapoff to deactivate)

also see /etc/swapspaces fileremoving swapupdate /etc/vfstabswapoff |swapoff |remove entry from /etc/fstabswapoff /dev/paging00swap -drebootrmps paging00Remove device or file as normalRemove device or file as normalNote: paging space must be deactiviated before removing

Disks, Filesystems and Devices

Command DescriptionSolarisRed HatUbuntu/DebianHP-UXAIXDisk Drivesformatfdisk -lfdisk -lioscan -funC disklsdev -Cc diskprtvtoc sfdisk -l (advanced server)sfdisk -l (advanced server)lsdev -Cc disk -p scsi0 (specific controller)parted printparted printlsdev -Cc disk -S [a|d|s] (available, defined,stopped)format -e (to convert EFI (zfs) to SMI)partprobe partprobe lscfg -v -l hdisk0Note:EFI - Extensible Firmware InterfaceSMI - Sun Microsystems IncDisk serial Number, type, etcformathdparm -i /dev/hdahdparm -i /dev/hdadiskinfo -v /dev/rdsk/c0t4d0 (detailed but no serial number)lscfg -vl hdisk0iostat -Enhdparm -I /dev/hda (detailed)hdparm -I /dev/hda (detailed)/opt/ignite/bin/print_manifest (no serial number)lscfg -vl hdisk*luxadm inq (A5x00 disk arrays)hdparm -Tt /dev/hda (speed test)haparm -Tt /dev/hda (speed test)## Insure that the online diagnostic support tools have been installedswlist -l bundle | grep 'Support Tools'sdparm -i /dev/sdbsdparm -i /dev/sdb## Command-Line Support Tools Manager (cstm)cat /proc/ide/ide0/hda/modelcat /proc/ide/ide0/hda/model## The run cstmcat /proc/scsi/scsicat /proc/scsi/scsicstmcstm> mapcstm> sel dev 4 (select the disk of you choice)cstm> infocstm> il(obtain the serial number)cstm> quitDisk disk partitionsprtvtoc fdisk -lfdisk -llvlnboot -v /dev/vg00lsvg -l rootvgsfdisk -l (advanced server)sfdisk -l (advanced server)lifls -Clv lchangelvcat /etc/vfstabcat /proc/partitions (very high level)cat /proc/partitions (very high level)# Display the LIF contentscat /etc/filesystemscat /etc/fstabcat /etc/fstablifcp /dev/dsk/c0t6d0:AUTO -

cat /etc/fstab

Note: Boot programs are stored in the boot area in Logical Interchange Format (LIF), which is similar to a file system. For a device to be bootable, the LIF volume on that device must contain at least the ISL(the initial system loader) and HPUX (the HP-UX bootstrap utility) LIF files. ISL is like GRUB.List Raw Partitionsuse format to partition the disk then just use the slice as a raw partition, remember to use the character device## Old waymknod /dev/rawctl c 162 0Just create a new LVOL without a filesystem - that's it.Just create a new LVOL without a filesystem/etc/sysconfig/rawdevicesmknod /dev/raw/raw0 c 162 1service rawdevices startmknod /dev/raw/raw1 c 162 2# create a raw volumechkconfig rawdevices onln -s /dev/rawctl /dev/raw/rawctlmklv -y rawVolume vg01 10

## New way, Edit below file## map raw devices to the disk/etc/udev/rules.d/60-raw.rulesraw /dev/raw/raw1 /dev/sdb1udevinfo -d or udevadm## display raw devices## Display raw partitionsraw -qaraw -qaFilesystem commandsdf -kdf -kdf -kbdfdf -kdf -hdf -hdf -hdf [-egiklnvfb]lsfs []lsfs -q (detailed)Filesystem (create|remove)newfs -v mkfs -t ext3 /dev/sdb1mkfs -t ext3 /dev/sdb1newfs -F vxfs -o largefiles /dev/vg01/rlvol1crfs -v jfs2 -d data02lv -m /data02 -A yes

# Display how the filesystem was createdmkfs -F vxfs -o largefiles /dev/vg01/rlvol1-v filesystem typenewfs -Nv -d device or logical volumeNote: mkfs and newfs are a pointer to /sbin/fs_wrapper-m mountpoint-A mount after restart [yes|no]

rmfs -ri /data02

-r remove the mountpoint-i display warning before removing

chfs -a size=+1G /var (grow by additional 1GB)chfs -a size=1G /var (grow to 1GB in size)Tune Filesystemstunefstune2fstune2fstunefs -v chfsfstyp -v |grep -i minfreetune2fs -l /dev/sda1tune2fs -l /dev/sda1vxtunefs -v fstyp -v Note: you can perform the following# change reserved blocks percentage to 1%# change reserved blocks percentage to 1%resizetune2fs -m 1 /dev/sda1tune2fs -m 1 /dev/sda1# Disk fragmentationfreezefsadm -F vxfs -E / (report)change mountpointfsadm -F vxfs -e / (defrag)permissionslots more..............................Force fscktouch /forcefscktouch /forcefsckn/ashutdown -Fr nowshutdown -r now

# Check to see filesystem needs checkingtune2fs -l /dev/sdb |grep -i 'filesystem state'tune2fs -l /dev/sdb |grep -i 'filesystem state'# Look at the second line to see if a filesystemfstyp -v | grep fsclean# needs checking# edit /etc/default/rcS change below sotunefs -v # you dont have to hang aroundFSCKFIX=yesbackup filesystemufsdump|ufsrestoredump/restoredump/restorefbackup/frecoverbackup|restoretartartardump/restoretarddddddftioddcpiocpiocpiotarcpioddcpioDisplay the boot deviceeeprom |grep boot-devicecat /boot/grub/grub.confcat /boot/grub/menu.lstsetbootbootinfo -b (display last boot device)prtconf -pv |grep bootpathcat /etc/lilo.confbootlist -m [normal|service] -o (display bootable devices)prtpicl -v|grep ':bootpath'grub = grand unified boot loaderlilo = linux loaderSetting the boot devicesetenv boot-device [|]/boot/grub/grub.conf/boot/grub/menu.lstsetboot -p bootlist -m normal hdisk0 hdisk1eeprom boot-device [|]/etc/lilo.confsetboot -a

# autoboot sequncesetboot -b [on|off]Creating boot device (MBR)installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk grub-install grub-install mkboot -l bosboot -a (uses default device)lilo -vbosboot -ad hdisk1Note: we are treating the disk as a LVM deviceFormat floppy drivefdformat -v -Ufloppy --probe (use device obtained below )n/an/aformat -d /dev/rfd0volcheck -vfloppy --createrc > /etc/fd0format -d /dev/fd0.18 (high format)newfs -v /vol/disk/aliases/floppy0floppy --format /dev/fd0mkfs /dev/fd0mount/unmount floppyvolrmmount -l floppy0mount /dev/fd0 /mnt/floppyn/an/amount /dev/rfd0 /floppyeject floppyumount /mnt/floppymount/unmount CDROMmount -F hsfs -o ro /cdrom/cdrom0mount -rt iso9660 /dev/cdrom /mnt/cdrommount -rt iso9660 /dev/cdrom /mnt/cdrommount -rF cdfs /dev/dsk/c1t6d0 /cdrommount -v cdrfs -r /dev/cd0 /cdromumount /cdrom/cdrom0umount /mnt/cdromumount /mnt/cdromumount /cdromeject cdromeject cdromstart: /usr/sbin/pps_mountd/etc/init.d/volmgr startpps_mounteject cdromremount a filesystemn/amount -o remount,rw /mount -o remount,rw /mount_vxfs -o remount,ro mount -o remount,rw

Note:I did find a note that it should be possible to remount a jfs2 filesystem, but it did not work on my systemcreate boot disk or recovery tapen/amkbootdisk `uname -r` (boot diskette)n/arecovery tape (preview)mksysbmake_tape_recovery -v -l -x inc_entire=vg00/opt/ignite/bin/make_recovery -ACvboot cdrom/diskette (single user)ok> boot cdrom -susing the grub window append the wordsingleto the kernel lineusing the grub window append the wordsingleto the kernel lineenter PDCbased on a 9114-275 workstation> search>boot p1 (cdrom)1. Restart the machine.interact with IPL? Y2. Wait the the AIX splash screen to come up. Devices begin to initialize here.ISL> hpux -is3. When you see the [keyboard] word on screen hit the F5 button or the 5 key depending on your console.4. Choose default boot list when the maintenance screen comes up.

boot into maintenace modeok> boot -asf10 or f12f10 or f12>boot pribased on a 9114-275 workstationinteract with IPL? YISL> hpux -lm1. Restart the machine.2. Wait the the AIX splash screen to come up. Devices begin to initialize here.3. When you see the [keyboard] word on screen hit the F5 button or the 5 key depending on your console.4. Choose select boot options when the maintenance screen comes up, then option 1, then option 1 for scsi, then option 3 service mode boot

Device pathsfloppy:floppy:floppy:floppy:floppy:/dev/fd0/dev/fd0n/a/dev/fd0disk:/dev/rfd0/dev/dsk/c0t0d0s0disk:disk:disk:/dev/hda or /dev/sda/dev/hda or /dev/sda/dev/dsk/c0t6d0disk:tape:/dev/hdb or /dev/sdb/dev/hdb or /dev/sdb/dev/hdisk0/dev/rmt/0ucbtape:tape:tape:/dev/dsk/rmt/0tape:cdrom:/dev/dsk/c0t6d0s0cdrom:cdrom:cdrom:cdrom:/dev/scd0 (external usb cd)/dev/hda (depends on number of IDE disks)/dev/hda (depends on number of IDE disks)/dev/dsk/c1t6d0/dev/cd0

update /dev directorydrvconfig/dev/MAKEDEV /dev/MAKEDEV insf -C tape (Class)cfgmgrdevlinkscfgmgr -l scsi0disks|tapes|portsinsf -H 0.1.0 -e (recreate deleted link)mkdevdevfsadm ( solaris 8, 9, 10)remove or change a devicerem_drv# remove all devices from a hardward pathrmdevrmsf -k -H 52.6.0rmdev -l cd0

chdevchdev -l rmt0 -a ret=nolist device driversprtconf -Dcat /proc/devicescat /proc/deviceslsdevlsdevsysdeflsdev -Cc disklsdev -Cc disk -p scsi0

lsslot -c pci -l ent0

lscfglscfg -l ent0lscfg -vl fcs0 (find the WWN of HBA adapter)

lspath -l hdisk0

getconf DISK_SIZE hdisk1 (detailed)

Networking

SolarisRed HatUbuntu/DebianHPAIXBasic network information/etc/hostname.hme0/etc/sysconfig/network/etc/network/interfaces/etc/rc.config.d/netconfstores information in the ODM (Object Database Manager) (hostname, ip address)/etc/sysconfig/network-scripts/ifcfg-eth0displaying network interfacesprtdiag -vifconfigifconfigioscan -funC lan (list hardware)ifconfig -aifconfig -asystem-config-network (GUI)lanscan -v (list configured)ifconfig lan0 (individual)entstat -d kstat hme:0kstat e1000g:0lsdev -Cc iflsdev -Cc tcpip

odmget -q "name=en0" CuAt

lsattr -EHl en0Configure network interfaceifconfigifconfigifconfigifconfig mktcpip (completely setup a network interface)rmtcpip (remove all network interfaces)

# configure an interfacemktcpip -h aix1 -a 192.168.1.200 -m 255.255.255.0 -i en1 -g 192.168.0.10

-h - hostname assigned to interface-a - ip address-m - netmask-i - interface name-g - gateway ip address

# remove an interfaceifconfig en1 detach

ifconfig (configures IP address)

chdev (add aliases to network interface)Starting and stopping a network interfaceifconfig qfe0 up/sbin/ifup eth0/sbin/ifup eth0ifconfig lan0 upifconfig en0 upifconfig qfe0 down/sbin/ifdown eth0/sbin/ifdown eth0ifconfig lan0 downifconfig en0 downifconfig en0 detach (remove)note: there is no "ifconfig -a" in hpux use lanscan then "ifconfig "Setting NIC speedndd -set (dynamically)mii-tool -F 100baseTx-FD eth0ethtool -s eth1 speed 100 duplex fullndd -set chdev -l ent0 -a media_speed=1000_Full_Duplex -P/etc/system (edit and update then reboot - permanent)ethtool -s eth1 speed 100 duplex fulllanadmin -X lan0chdev -l ent0 -a media_speed=Auto_Negotiation -P

Note:entX - physical deviceenX - frame type run on entXChange NIC parametersndd -get mii-tool -vethtool eth0lanadmin -> lan -> displaynetstat -vethtool eth1entstat -d # List parametersethtool -t eth0 onlinesysctl -a |grep net*## options supportedndd -get /dev/hme \?ndd -get /dev/ip ?no -andd -get /dev/e1000g0 \?sysctl -a | grep net*ndd -get /dev/tcp ?no -o "ipforwarding=1"ndd -get /dev/ip \?ndd -get /dev/arp ?ndd -get /dev/tcp \?ndd -get /dev/udp ?Display NIC statisticsnetstat -i [-I interface]netstat -i [-f inet]netstat -snetstat -sentstat -d display MAC addressifconfig -a (as user root)ifconfigifconfiglanscannetstat -iasystem-config-network (GUI)Displaying network packetssnoop -d tcpdump -i tcpdump -i nettl -starttcpdump -i nettl -status alliptrace -i ethereal (needs to be installed)ethereal (needs to be installed)nettl -tn pduin pduout -e ns_ls_driver -file /var/adm/LANipreport (used with iptrace to view reports)nettl -stopNote: you must stop the iptrace by using "kill -15"use netfmt to display the trace filedefault router/etc/defaultrouteredit /etc/sysconfig/networkedit /etc/network/interfaces/etc/rc.config.d/netconfroute add 0

route add default add: GATEWAY=add: gateway Note: there is no file that holds the default routerdisplay routing tablenetstat -rnnetstat -rnnetstat -rnnetstat -rnnetstat -rnroute -nroute -nnetstat -r -f inetlsattr -EHl inet0 -a routeTest IPMP, Bondingif_mpadm -d (detach)ifenslave -d bond0 eth1 (detach)ifenslave -d bond0 eth1 (detach)You buy an optional product called Auto-Port Aggragation.smitty etherchannel (creates, deletes and tests)if_mpadm -r (reattach)ifenslave bond0 eth1 (reattach)ifenslave bond0 eth1 (reattach)entstat -d ent0tail /var/adm/messagescat /proc/net/bonding/bond0cat /proc/net/bonding/bond0change the hostnamechange the following files:/etc/sysconfig/network/etc/hostnameset_parms hostname (requires reboot)hostname /etc/hosts/etc/hostschdev -l inet0 -a hostname=/etc/nodename/etc/hostname.sysctl -a |grep hostnamesysctl -a |grep hostname/etc/inet/hosts/etc/inet/ipnodes/etc/net - few files in here as wellsetup DNS/etc/resolv.conf/etc/resolv.conf/etc/resolv.conf/etc/resolv.conf/etc/resolv.confName service switch file (DNS client)/etc/nsswitch.conf/etc/nsswitch.conf/etc/nsswitch.conf/etc/nsswitch.conf/etc/netsvc.conf/etc/resolv.conf/etc/host.conf/etc/host.conf/etc/resolv.conf/etc/resolv.conf/etc/resolv.conf/etc/resolv.conf/etc/irs.conf (may not be there)

chnamsv (change name service)rmnamsv (remove a name service)lsnamsv -C (list name services)Flush DNS cachesvcadm restart system/name-service-cache:default## if installedn/anetcdctrl -t dns -e hosts -fservice nscd restartDomain Name/etc/defaultdomain/etc/sysconfig/network (HOSTNAME option)/etc/host/etc/rc.config.d/netconfdomainname /etc/resolv.conf/etc/resolv.conf

Note: for NIS use the NISDOMAIN optionObtain IP Address routingroute -n get ip route get ip route get n/aroute -n get traceroutetraceroutetracerouteFind Services on the networkBoot (jumpstart) servers:Boot (jumpstart) servers:Boot (jumpstart) servers:Boot (jumpstart) servers:Boot (jumpstart) servers:rpcinfo -b bootparam 1rpcinfo -b bootparam 1rpcinfo -b bootparam 1rpcinfo -b bootparam 1rpcinfo -b bootparam 1

NFS servers:NFS servers:NFS servers:NFS servers:NFS servers:rpcinfo -b mountd 1rpcinfo -b mountd 1rpcinfo -b mountd 1rpcinfo -b mountd 1rpcinfo -b mountd 1

NIS servers/slaves:NIS servers/slaves:NIS servers/slaves:NIS servers/slaves:NIS servers/slaves:rpcinfo -b ypserv 1rpcinfo -u ypservrpcinfo -u ypservrpcinfo -b ypserv 1rpcinfo -b ypserv 1

Crash Dump

SolarisRed HatUbuntu/DebianHPAIXCrash Dumpdumpadm -d diskdumpdiskdumpedit /stand/systemsysdumpdev -l (list dump destination)netdumpnetdumpsysdumpdev -e (estimates dumpsize)crash (used to analyse crash dumps)kdump (part of kexec rpm)kdump (part of kexec rpm)add either:sysdumpdev -L (info)adb (used to analyse crash dumps)dump2/0/1.5.0/etc/kdump.conf (select where you want the dump to go)/etc/kdump.conf (select where you want the dump to go)dump lvolsysdumpstart -p (start dump primary)service kdump startservice kdump startdump nonesysdumpstart -s (start dump secondary)chkconfig kdump onchkconfig kdump on# crash config file# set the dump device permanently## to crash the system## to crash the system/etc/rc.config.d/savecrashsysdumpdev -p -Pecho "c" > /proc/sysrq-triggerecho "c" > /proc/sysrq-trigger# analyse dump filecrash (used to analyse crash dumps)crash (used to analyse crash dumps)echo "stat\n status\n t -m" | crash /var/adm/ras/vmcore.0

Performance Monitoring and Diagnostics

SolarisRed HatUbuntu/DebianHPAIXCPUtop (sunfreeware)toptoptoptopas -Pprstatsarsarsartopas -L(logical partitions)sarmpstatmpstatw (load average)mpstatmpstatw (load average)w (load average)uptime (load average)sar -cw (load average)uptime (load average)uptime (load average)psw (load average)uptime (load average)pspsvmstatuptime (load average)psvmstatvmstatglancelparstatvmstatprocinfoprocinfosampsoprofilecat /proc/cpuinfoiostat -tT 1cat /proc/cpuinfotprofcurtMemoryprstatfreefreetoptopasvmstatvmstatvmstatvmstatvmstattoptoptopsarsar -bsarprocinfoprocinfosamsvmonslabtopslabtopglancepssarsaripcs -acat /proc/meminfocat /proc/meminfolockstat (version 4)rmssNetwork I/Onddethtoolethtoolnetstat[ent|tok|fddi|atm]statnetstatmii-toolmii-toollanadminnetstatlsofnetstatnetstatsamnetpmon (trcstop to stop trace)snooplsoflsofglanceroutetcpdumptcpdumpipipiptrafiptrafDisk I/Osar -dsar -dsar -diostattopas -D(disk)iostatiostatiostatsartopas -F(filesystem)vmstatvmstatvmstatsamiostatlsoflsoflsofglancesar -Dfcstat (fibre)lvmstatfilemon (trcstop to stop)fileplace

# disk stat historychdev -l sys0 -a iostat=truelsattr -HEl sys0 -a iostatApplicationtruss -p strace -p strace -p download and installtusctopastrusstusc -p sarprobevuetprofsvmon -P NFSnfsstatnfsstatnfsstatnfsstatnfsstat

Kernel Modules and Parameters

SolarisRed HatUbuntu/DebianHPAIXdisplay loaded modulesmodinfocat /proc/modules (more detailed)cat /proc/modules (more detailed)kmadmin -kgenkexlsmodlsmod

Location:Location:/lib/modules/`uname -r`/kernel/drivers/lib/modules/`uname -r`/kernel/drivers

Config:Config:/etc/modprobe.conf/etc/modprobe.d/options/etc/modprobe.d/etc/modprobe.d

load modulesmodload -p drv/modprobe modprobe kmadmin -L n/ainsmodinsmodunload modulesmodunload -i modprobe -r modprobe -r kmadmin -U n/armmodrmmodkmadmin -u set kernel parameters (tuning)/etc/system (edit and reboot)/etc/sysctl.conf (edit and update then reboot)/etc/sysctl.conf (edit and update then reboot)kcweb (11i)chdev -l sys0 -a =sysctl -p sysctl -p kctune (11i only)no-a(network)rebuild kernel (< 11i see below)vmo-a(virtual memory)sysctl -w param=valuesysctl -w param=valuenfso-a(NFS)ioo-a(Input/Ouput)No reboot (dynamically):No reboot (dynamically):raso -a (reliability, availability, serviceability)echo "250 32000 100 28" > /proc/sys/kernel/semecho "250 32000 100 28" > /proc/sys/kernel/semschedo-a(processor scheduler)echo "536870912" > /proc/sys/kernel/shmmaxecho "536870912" > /proc/sys/kernel/shmmaxecho "4096" > /proc/sys/kernel/shmmniecho "4096" > /proc/sys/kernel/shmmnivi /etc/security/limitsecho "2097152" > /proc/sys/kernel/shmallecho "2097152" > /proc/sys/kernel/shmallcd /etc/tunablesetc.............................................etc.............................................tunchange, tundefault, tunsave, tunrestore, tuncheck

Note: most parameters are dynamically changed in AIX , for example memory segments are dynamically adjusteddisplay kernel parameterscat /etc/systemsysctl -asysctl -akctune (11i only)lsattr -EHl sys0sysdef -icat /etc/sysctl.confcat /etc/sysctl.confsysdefkmtuneNote: only a few kernel parameters can be changedcat /proc/sys/kernel/semcat /proc/sys/kernel/semkmsystemcat /proc/sys/kernel/shmmaxcat /proc/sys/kernel/shmmax/usr/sam/lbin/getkinfo -f /stand/vmunix -o /tmp/kernel.dataetc...................................etc...................................build kerneledit and update file then reboot:cd /usr/src/linux-2.5cd /stand/buildchdev -l sys0 -a =/etc/systemedit Makefile (change EXTRAVERSION)/usr/lbin/sysadm/system_prep -v -s systemmake mrproperedit system fileNote: most parameters are dynamically changed in AIX , for example memory segments are dynamically adjustedbackup .config/usr/sbin/mk_kernel -s ./systemmake xconfigmv /stand/system /stand/system.oldmake depmv /stand/vmunix /stand/vmunix.oldmake bzImagemv /stand/build/system /standmake modulesmv /stand/build/vmunix_test /stand/vmunixmove new kernelrebootmake modules_installchange lilo/grub config filerebootinterprocess communicationipcs -aipcs -aipcs -aipcs -aipcs -a

Services

Solaris 10Red HatUbuntu/DebianHPAIXdisplay servicessvcs -aservice --status-allThere is no services or chkconfig command use the old fashioned way /etc/init.d/There is no services or chkconfig commandlssrc -ainetadm -luse the old fashioned way /sbin/init.d/start servicessvcadm enable nfsservice nfs startstartsrc -s startsrc -g stop servicessvcadm disable nfsservice nfs stopstopsrc -s stopsrc -g reload servicesvcadm refresh nfsservice nfs reloadrefresh -s restart servicesvcadm restart nfsservice nfs restartstopsrc -s startsrc -s service statussvcs nfsservice nfs stauslssrc -aservice dependenciessvcs -d networkn/an/aservice dependantssvcs -D networkn/an/aservice logging, etc/var/svc/logn/a/var/adm/ras/var/svc/manifest/etc/syslog.conf/lib/svc/method/etc/rc.tcpipchange service startupn/achkconfig --levels 2345 nfs onn/aAdd a new servicen/a# Create your stop/start# script in /etc/init.d

chkconfig --add

Patching / Software

SolarisRed HatUbuntu/DebianHPAIXdisplay installed patchesshowrev -pswlist -l bundleinstfix -iapatchadd -pswlist -l productswlist -l patchadding patchpatchaddpatch -p1 instfix -kpatchadd -M (multiple patches)swcopy (install patch into depot)zcat patch46.gz | patch -p1swinstall (install patch from depot)

Note: -p = # of path strippingNote: the swagentd daemon must be runningremoving patchpatchrmpatch -R -p1 swremoveinstallp -rdisplay installed packagespkginfo (all packages)rpm -qa (all packages)dpkg -lswlist -l bundle lslpp -L all (all filesets)pkginfo -l (single package)rpm -q (single package)dpkg -S (search)swlist -l product lslpp -L (single fileset)pkgchk -l -p (file belongs)rpm -qf (file belongs)dpkg -S (file belongs)lslpp -w (file belongs)rpm -qi (very detailed)dpkg -s (status)## check a packagelslpp -ha (history of filesets)dpkg -p (detailed)swlist -s rpm -qa (all packages)rpm -q (single package)rpm -qf (file belongs)rpm -qi (very detailed)

oslevel -g (install packkages above os level)

whereis which_fileset adding packagepkgaddrpm -Uhv (updates/installs if not already)dpkg -i swinstallinstallp -arpm -ihv (install)swinstall -s installp -c (cleanup after failed install)

rpm -i

geninstall (generic installer: installp, RPM, etc)removing packagespkgrmrpm -e dpkg -r (do not remove config files)swremoveinstallp -u (commited packages)dpkg -P (remove config files)installp -r (applied packages)

rpm -e

geninstall -u verify packagepkginfo -lrpm -V n/aswverity (see /var/adm/sw/swagent.log)lppchk -vpkginfo -prpm -V List files in packagepkgchk -l | grep -i pathnamerpm -ql dpkg -L (list files)swlist -l file lslpp -f

rpm -ql Package directory/var/sadm/var/lib/rpm/var/lib/dpkg/info/var/adm/sw/usr/lpp

/var/lib/rpmList libraries required for binary programldd ldd ldd chatr ldd

Accounts

SolarisRed HatUbuntu/DebianHPAIXdisplay userscat /etc/passwdcat /etc/passwdcat /etc/passwdcat /etc/passwdcat /etc/passwdsystem-config-users (GUI)logins -xlogins -xlsuser -f ALL (detailed)create a useruseradduseradduseradduseraddmkusersystem-config-users (GUI)samuseraddremove a useruserdeluserdeluserdeluserdelrmusersystem-config-users (GUI)samuserdelmodify a userusermodusermodusermodusermodchuser -asystem-config-users (GUI)samusermodpasswd -fpasswd -schfn chfn change user passwordpasswdpasswdpasswdpasswdpasswdpwdadmpwdck -t ALLcreate a groupgroupaddgroupaddgroupaddgroupaddmkgroup remove a groupgroupdelgroupdelgroupdelgroupdelrmgroup modify a goupgroupmodgroupmodgroupmodgroupmodchgroup password files/etc/passwd/etc/passwd/etc/passwd/etc/passwd/etc/security/passwd/etc/shadow/etc/shadow/etc/shadow/tcb/files/auth/r/root (trusted system)useful user commandsid -aid -aid -aididwhoamiwhoamiwhoamiwhoamiwhoamiwhowhowhowhowhowwwwwfingerfingerfingeruptime (displays # of users logged in)uptime (displays # of users logged in)fingerfinger

# License informationlslicensechlicense

# Maximum number of processes for a userlsattr -D -l sys0 -a maxuprocchdev -l sys0 -a maxuproc=useful group commandsgroupsgroupsgroupsgroupsgroupssetpgrpsetprivgrpsetgroupsnewgrplsgroup ALL

NFS

SolarisRed HatUbuntu/DebianHPAIXNFS Daemonsserver: mountd, nfsdserver: rpc.mountd,nfsdserver: rpc.mountd,nfsdserver: rpc.mountd, nfsdserver: rpc.mountd, nfsdclient: statd, lockdclient: rpc.statd, lockdclient: rpc.statd, lockdclient: rpc.statd, lockdclient: rpc.statd, rpc.lockdNFS files/etc/dfs/dfstab/etc/exports/etc/exports/etc/exports/etc/exports/etc/dfs/sharetab/var/lib/nfs/etab/var/lib/nfs/etab/etc/xtab/etc/xtab/etc/rmtab/var/lib/nfs/xtab/var/lib/nfs/xtabList nfs clients that have a remote mount/etc/rmtab/var/lib/nfs/rmtab/var/lib/nfs/rmtab/etc/rmtab/etc/xtabdisplay nfs sharesdfsharesshowmount -e localhostshowmount -e localhostshowmount -e localhostexportfsshowmount -e localhostshowmount -e localhostcreate nfs share/etc/dfs/dfstab (edit and add share)redhat-config-nfs (GUI)/etc/exports (edit and add share, see below example)/etc/rc.config.d/nfsconf (edit)mknfsexp -d share exportfs -rav (export the shares)/etc/exports (edit and add share)mknfsmnt/etc/exports (edit and add share)exportfs -a## dfstab example/sbin/service nfs reload/etc/init.d/portmap restartshareallshare -F nfs -d "jumpstart" /export/jumpstart/etc/init.d/nfs-kernel-server restart## /etc/exports example/export *(rw,fsid=0,insecure,no_root_squash,sync)## /etc/exports example/export *(rw,fsid=0,insecure,no_root_squash,sync)uncreate nfs shareunshare /etc/exports (edit and remove share)/etc/exports (edit and remove share)/etc/rc.config.d/nfsconf (edit)rmnfsexp-d (unshares and removes from file)/etc/dfs/dfstab (edit and remove share)/sbin/service nfs reloadexportfs -rav (export the shares)exportfs -au (unshare all)exportfs -u /home/vallepexportfs -u /etc/exports (edit and remove share)unshareall

start/change nfs daemons/etc/init.d/nfs.server start/sbin/service nfs start/etc/init.d/portmap start/sbin/init.d/nfs.core startmknfs/etc/init.d/nfs.client start/etc/init.d/nfs-kernel-server start/sbin/init.d/nfs.server startchnfs/sbin/init.d/nfs.client startsvcadm enable nfs/serverstartsrc -s nfsdsvcadm disable nfs/serverstartsrc -s rpc.mountdstop nfs daemons/etc/init.d/nfs.server stop/sbin/service nfs stop/etc/init.d/portmap stop/sbin/init.d/nfs.client stoprmnfs/etc/init.d/nfs.client stop/etc/init.d/nfs-kernel-server stop/sbin/init.d/nfs.server stop/sbin/init.d/nfs.core stopstopsrc -s nfsdstopsrc -s rpc.mountdnfs statusps -ef|grep < nfs daemons>/sbin/service nfs status/etc/init.d/nfs-kernel-server statusps -ef | grep lssrc -a |grep -i nfsnfs reloadshareall/sbin/service nfs reloadexportfs -rav (export the shares)exportfs -aexportfs -avnfs performanacenfsstatnfsstatnfsstatnfsstatnfsstatnfs Optionsn/acat /var/lib/nfs/etabcat /var/lib/nfs/etabn/anfso -anfso -o =

exportfs (display options)solaris/redhat mount problems (nfs v3 to v4)## Make sure you use NFS version 3n/an/an/an/amount -F nfs -o vers=3

NTP

SolarisRed HatUbuntu/DebianHPAIXTime daemonsxntpdntpdntpdxntpdxntpdntp setup# Solaris 8/etc/ntp.conf (edit with ntp servers)/etc/default/ntp/etc/rc.config.d/netdaemons (set XNTPD to 1)/etc/ntp.conf/etc/ntp.confdateconfig (GUI)/etc/ntp.conf/etc/ntp.conf/etc/ntp.serverstartsrc -s xntpd/etc/ntp.clientchkconfig --list ntpd/etc/init.d/ntp [start|stop|restart]stopsrc -s xntpdchkconfig --level 2345 ntpd on/etc/rc2.d/xntpd [start|stop]/sbin/service ntpd startlslpp -L all|grep xntpd

# Solaris 10/etc/inet/ntp.server/etc/inet/ntp.client

svcadm enable ntpdntp daemon options/lib/svc/method/xntp/etc/sysconfig/ntpd/etc/default/ntp/etc/rc.config.d/netdaemonsstartsrc -s xntpd -a "-x"

/etc/rc.tcpipNTP Trace commandsntpq -pntpq -pntpq -pntpq -pntpq -pntptracentptracentptracentpdate (set the date)ntptracentpdate

Log Files

SolarisRed HatUbuntu/DebianHPAIXmessages/var/adm/messages/var/log/messages/var/log/messages/var/adm/syslog/syslog.log/var/adm/rassyslog/var/log/syslog/var/log/syslog/var/log/syslog/var/adm/syslog/syslog.log/var/adm/rasmail/var/log/mail/var/log/mail.*/var/adm/syslog/mail.log/usr/spool/mqueue/syslogcron/var/cron/log/var/log/cron/var/log/cron.log/var/adm/cron/log/var/adm/cron/logboot/var/adm/messages/var/log/boot/var/log/boot/var/adm/syslog/syslog.log/var/adm/rasdmesgdmesgdmesgdmesgalog -o -t bootalog -o -t consolealog -L (list all the logs available)Error loggingloggerloggerloggerlogger/usr/lib/errdemon -l (display attributes)/usr/lib/errdemon (start error logging)/usr/lib/errstop (stop error logging)

# use with above errorlog fileerrpt (summary errorlog report)errpt -a (detailed errorlog report)errpt -j (single errorlog report)

errclear (clears errorlog)errclear -d (clears class errors)

errlogger "message upto 230 chars"

Security

SolarisRed HatUbuntu/DebianHPAIXChecking the passwd filepwckpwckpwckpwckpwdck -t ALLusrck -t ALLchecking the group filegrpckgrpckgrpckgrpckgrpckconsole login (allow/deny)# No reboot required# No reboot required# No reboot required# No reboot required# No reboot required/etc/default/login/etc/securetty/etc/securetty/etc/securetty/etc/security/user

Note: you may need to create this file if it does not existchsec -f /etc/security/user -s root

Misc

SolarisRed HatUbuntu/DebianHPAIXstartupeepromgrub (GUI)grub (GUI)setboot -p bootlist -m normal hdisk0 hdisk1lilo (text based)setboot -a setenv boot-device# autoboot sequncesetboot -b [on|off]shutdownshutdown -i5 -g0 -y (power down)shutdown -h (halt)shutdown -h (halt)shutdown -h now (halt)shutdown -F (fast shutdown)shutdown -i6 -g0 -y (reboot)shutdown -r (reboot)shutdown -r (reboot)shutdown -r now(reboot)shutdown -Fr (fast shutdown and reboot)shutdown -i0 -g0 -y (OK prompt)shutdown -f (fast reboot no fsck)shutdown -P (power off)shutdown -F (force fsck)reboot -- -r (reboot/reconfigure)touch /forcefsck

touch /reconfigure# edit /etc/default/rcS change below so# you dont have to hang aroundFSCKFIX=yesChange run levelhalthalthaltinitinitinitinitinitrebootshutdownpoweroffpoweroffpoweroffshutdownrebootrebootrebootreboottelinitshutdownshutdownshutdownhalttelinittelinittelinituadmininit status00 - shutdown0 - halt0 - halt0 - halt0 - reserved11 - single user1 - single user1 - single user1 - single users1 - reserved22 - n/a2 - multiuser (no networking)2 - multiuser (default)2 - multiuser (networking)2 - multiuser mode with NFS33 - Multi-user3 - multiuser (networking)3 - same as 23 - multiuser (networking, NFS, and CDE GUI) (default)3 - user defined44 - n/a4 - unused4 - same as 24 - multiuser (netwrking, NFS, and VUE GUI)4 - user defined55 - power off5 - GUI5 - same as 25 - n/a5 - user defined66 - reboot6 - reboot6 - reboot6 - n/a6 - user defined7-9 - user defined

# change default - change theinitdefaultline# change default# change default# change default - change all the telinit# change default - change theinitdefaultlinevi /etc/inittabvi /etc/inittabvi /etc/inittabvi /etc/event.d/rc-defaultvi /etc/inittabStartup options-s single usersingle- use grub to edit kernel linesingle- use grub to edit kernel lineinteract with IPL? YBased on 9114-275 workstation-a interactiveemergency - use grub to edit kernel lineemergency - use grub to edit kernel line-x no device drivers (used in clustering)linux rescue - use at the boot promptlinux rescue - use at the boot prompt# single user1. switch off the machine-r reconfigure devicesISL> hpux -is-m milestonesingle: runlevel1, local fs mounted, no networksingle: runlevel1, local fs mounted, no network2. power on and enter the SMS menuemergency: root fs read-only, no init files runemergency: root fs read-only, no init files run# Logical volume maintanence moderescue: use cd-rom/network, root mounted as /mnt/sysimagerescue: use cd-rom/network, root mounted as /mnt/sysimageISL> hpux -lmNote: to enter the SMS menu press numeric 1 after the word keyboard but before the word speaker

# No quroum checkISL> hpux -lqstartup scripts/etc/init.d/etc/init.d/etc/init.d/sbin/init.d/etc/rc.d/etc/rc.config.d (startup config files)/etc/rc.d/init.d/etc/rc0.d - /etc/rc6.d/etc/rc0.d - /etc/rc6.d/etc/rc0.d - /etc/rc6.d/sbin/rc0.d - /sbin/rc6.d/etc/rc.d/rc2.d - rc9.d

/etc/rc.* (config files for auto-starting)

also uses the System Resource Controllerboot prompt commandsbootF10 or F12F10 or F12interact with IPL? YBased on a 9114-275 workstationprintenvsetenv1. switch off the machinebannerdevalias2. power on and enter the SMS menushow-devsshow-pci-devs-allNote: to enter the SMS menu press numeric 1 after the word keyboard but before the word speakerprobe-scsi-allprobe-fcal-allprobe-pciwatch-net-allreset-allBoot processPhases:Boot sequenceBoot sequencePhases:Phases:

Boot PROM: displays system information, run POST, load bootblk, locate ufsboot1. BIOS1. BIOS1. PDC - processor-dependent code; executes and performs self-testsRead Only Storage (ROS): check the system board, perform POST, locate and load boot image, begin system initialization and execute phase 1 of the /etc/rc.boot scriptBoot Programs: bootblk loads and executes the ufsboot2. POST2. POST2. ISL - initial system loader; loads the secondary system loaderhpuxBase Device Configuration: start configuration manager to configue base devicesKernel Initialization: ufsboot loads and executes the core kernel, initializes core kernel data structures, loads other kernel modules based on the/etc/systemfile, starts/sbin/initprogram3. Master Boot Record (MBR) - point to the bootloader GRUB or LILO3. Master Boot Record (MBR) - point to the bootloader GRUB or LILO3. HPUX - is the secondary system loader and loads the kernel /stand/vmunix, then hands over to the kernelSystem Boot: start init process phase 2, switch to hard-disk root filesystem, start other processes defined by /etc/inittab and execute phase 3 of the /etc/rc.boot scriptinit: starts other processes based on the/etc/inittabfile4. GRUB (stage 1) - point to GRUB stage 1_54. GRUB (stage 1) - point to GRUB stage 1_54. KERNEL - swapper processes are started by the kernel then starts theinitprocess5. GRUB (stage 1_5) - deals with specific filesystem types look at /boot/grub/*1_5 files5. GRUB (stage 1_5) - deals with specific filesystem types look at /boot/grub/*1_5 files5. INIT - reads /etc/inittab6. GRUB (stage 2) reads /etc/grub.conf and displays the grub menu, it specifies the kernel and the initrd files6. GRUB (stage 2) reads /boot/grub/menu.lst and displays the grub menu, it specifies the kernel and the initrd files7. KERNEL - control given to the kernel7. KERNEL - control given to the kernel8. INIT - reads /etc/inittab and runs /etc/rc.d/rc.sysinit script8. INIT - runs the /etc/event.d/rc-default script

determine the run levelwho -rrunlevelrunlevelwho -rwho -rwho -rwho -robtain default run levelcat /etc/inittabcat /etc/inittab/etc/event.d/rc-default/etc/inittab/etc/inittablist localelocale -alocale -alocale -alocale -alocale -astart xwindowsn/astartx (shorthand of below)n/an/ainitx (lots of parms)initialize systemsys-unconfigset_parms [initial|hostname|ip_address|timezone]install_assist

Note: set_parms is in /sbinTimezone/etc/TIMEZONE/etc/sysconfig/clock/etc/timezone/etc/TIMEZONE/etc/environment/etc/default/init/usr/share/zoneinfo/zone.tab/usr/share/zoneinfo/zone.tab/etc/profile

Sheet2Command DescriptionSolarisRed HatUbuntu/DebianHP-UXAIXServer Release infocat /etc/releasecat /etc/enterprise-releasecat /etc/lsb-release/stand/kernrel

Sheet3