Common Unix Commands
Sysinfo | Display system information i.e cpu, memory, etc |
Memory and Swap | Information regarding the physical memory and swap area |
Disks, Filesystems and Devices | Displaying disk information, filesystems |
Networking | Display and configuring network parameters |
Crash Dump | Configure, display and use the crash dump utiltities |
Performance Monitoring and Diagnostics | List, Monitor and trace processes |
Kernel Modules and Parameters | Displaying, modifying and tuning kernel parameters |
Services | Display, start and stop services |
Patching / Packages | Installing and removing patches and software packages |
Accounts | Setting up and removing user accounts |
NFS | Information on NFS i.e starting, stopping, etc |
NTP | Network Time Protocol |
Log Files | Location to common log files |
Security | Security information |
Misc | Other stuff i.e shutdown, timezone, run level, etc |
Solaris |
Red Hat |
Ubuntu/Debian |
HP-UX |
AIX |
||
Server Release info | cat /etc/release | cat /etc/enterprise-release cat /etc/redhat-releaselsb_release -a cat /proc/version |
cat /etc/lsb-release
lsb_release -a |
/stand/kernrel |
oslevel -r |
Server Release info |
Server type | /usr/platform/`uname -i`/sbin/prtdiag -v | dmidecode | dmidecode | model uname -a |
prtconf | grep -i ‘System Model’ | Server type |
Hardware Info | prtdiag -v prtconf -D prtpicl -v [-c <class>]picl = platform information and control library |
lspci lsusb lshalNote: hal = hardware abstraction layer |
lspci lsusb lshal |
ioscan ioscan -fun [disk|tape|lan]/opt/ignite/bin/print_manifest cat /var/opt/ignite/local/manifest/manifest.info |
lscfg -v lscfg -l ent0 lscfg -vl fcs0 (find the WWN of HBA adapter)lsdev lsdev -Cc disk lsdev -Cc disk -p scsi0 lsslot -c [pci|phb|port] lsslot -c pci -l ent0 lspath -l hdisk0 diag |
Hardware Info |
Operating System | uname -a | uname -a | uname -a | uname -a | oslevel [-r|-s] | Operating System |
Memory | /usr/platform/`uname -i`/sbin/prtdiag -v prtconf | grep -i mem |
cat /proc/meminfo (detailed) free -omcat /proc/slabinfo |
cat /proc/meminfo (detailed) free -omcat /proc/slabinfo |
dmesg | grep -i physical /usr/sam/lbin/getmem /opt/ignite/bin/print_manifestcat /var/opt/ignite/local/manifest/manifest.info |
prtconf -m prtconf |grep -i memory lsattr -El sys0 -a realmem bootinfo -r |
Memory |
CPU (type, number, etc) | /usr/platform/`uname -i`/sbin/prtdiag -v
## display,offline,online |
cat /proc/cpuinfo (detailed) | cat /proc/cpuinfo (detailed) | /opt/ignite/bin/print_manifest sam -> performance monitors -> system propertiescat /var/opt/ignite/local/manifest/manifest.info |
prtconf |grep -i processor | CPU (type, number, etc) |
Disk Drives | format prtvtoc <device>format -e (to convert EFI (zfs) to SMI) Note: |
fdisk -l sfdisk -l (advanced server) parted <device> print partprobe -s <device>smartctl -a <device> |
fdisk -l sfdisk -l (advanced server) parted <device> print partprobe <device> |
ioscan -funC disk | lsdev -Cc disk lsdev -Cc disk -p scsi0 (specific controller) lsdev -Cc disk -S [a|d|s] (available, defined, stopped)lscfg -v -l hdisk0 |
Disk Drives |
Kernel File and associated directories | /kernel/genunix
/platform/`uname -m`/kernel |
/boot/initrd.?????.img /boot/vmlinuz |
/boot/initrd.img-?????-server /boot/vmlinuz-????-server |
/stand/vmunix | /unix
/usr/lib/boot Note: /unix – symbolic link to kernel file i.e /usr/lib/boot/unix_64 |
Kernel File |
Kernel 32 or 64 | isainfo -kv (solaris 9+) isalist (sparc v9 will be listed first) isainfo -b |
uname -a uname -m getconf -a |grep -i ‘long_bit’ cat /proc/version |
uname -a uname -m getconf -a |grep -i ‘long_bit’ |
getconf KERNEL_BITS ( version 11) /opt/ignite/bin/print_manifest |grep -i ‘os mode’HPUX < version 11 all 32 bit Note: determine if system supports 64 bit
|
prtconf -k bootinfo -K |
Kernel 32 or 64 |
Display Firmware | At the OK prompt type banner | boot into the BIOS (normally F2 or F12) | boot into the BIOS (normally F2 or F12) | workstations: reboot enter PDC type: IN (information menu) type: FV (Firmware Version) |
prtconf |grep -i firmware lscfg -pv invscout |
Display Firmware |
Display IRQ, IO ports and DMA | n/a | /proc/interrupts /proc/ioports /proc/dma |
/proc/interrupts /proc/ioports /proc/dma |
n/a | prtconf | Display IRQ, IO ports and DMA |
GUI admin tool | admintool | linuxconf | linuxconf | sam | smit smitty |
GUI admin tool |
Solaris |
Red Hat |
Ubuntu/Debian |
HP |
AIX |
||
Memory | /usr/platform/`uname -i`/sbin/prtdiag -v prtconf | grep -i mem |
cat /proc/meminfo (detailed) free -om |
cat /proc/meminfo (detailed) free -om |
dmesg | grep -i physical /usr/sam/lbin/getmem /opt/ignite/bin/print_manifestcat /var/opt/ignite/local/manifest/manifest.info |
prtconf -m prtconf |grep -i memory lsattr -El sys0 -a realmem bootinfo -r |
Memory |
page 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 physical | pagesize pagesize -a (display all supported pagesizes) |
page size (memory) |
display swap | swap -l swap -s |
cat /proc/swaps (detailed) swapon -s |
cat /proc/swaps (detailed) swapon -s |
swapinfo (displayed in KB) swapinfo -m (display in Mb) swapinfo -tm (total / Mb) |
lsps -a (detailed) lsps -s |
display swap |
adding swap | mkfile 5m /var/swapfile swap -a /var/swapfileupdate /etc/vfstab |
device: create partition with fdisk (type 82) file(create 50MB swap file): dd if=/dev/zero of=/var/swapfile bs=1024 count=50000mkswap <device>|<file> swapon <device>|<file> update /etc/fstab |
device: create partition with fdisk (type 82) file(create 50MB swap file): dd if=/dev/zero of=/var/swapfile bs=1024 count=50000mkswap <device>|<file> swapon <device>|<file> update /etc/fstab |
Create logical volume or filesystem
swapon <device> | -f <logical device> update /etc/fstab Note: -p = priority swap number . The nswapdevtunable system parameter controls the maximum number of swap devices. |
mkps -a -s 4 -n <volume group>
# change the attributes # change the logical volume attributes (name in this case) Note: -a reconfigure paging space after restart also see /etc/swapspaces file |
adding swap |
removing swap | update /etc/vfstab swap -d |
swapoff <device>|<file>
Remove device or file as normal |
swapoff <device>|<file>
Remove device or file as normal |
remove entry from /etc/fstab reboot |
swapoff /dev/paging00 rmps paging00Note: paging space must be deactiviated before removing |
removing swap |
Disks, Filesystems and Devices
Solaris |
Red Hat |
Ubuntu/Debian |
HP |
AIX |
||
Disk Drives | format prtvtoc <device> cfgadm -al fcinfo hba-port luxadm probe mpathadm list initiator-port mpathadm show <initiator-port name> iscsiadm list initiator-node iscsiadm list discoveryformat -e (to convert EFI (zfs) to SMI) Note: |
fdisk -l sfdisk -l (advanced server) parted <device> print partprobe <device>udevadm info -q all -n /dev/sda1 blkid dmsetup [ls|info] |
fdisk -l sfdisk -l (advanced server) parted <device> print partprobe <device> |
ioscan -funC disk | lsdev -Cc disk lsdev -Cc disk -p scsi0 (specific controller) lsdev -Cc disk -S [a|d|s] (available, defined,stopped)lscfg -v -l hdisk0 |
Disk Drives |
Disk serial Number, type, etc | format iostat -En luxadm inq <disk> (A5x00 disk arrays) |
hdparm -i /dev/hda hdparm -I /dev/hda (detailed)hdparm -Tt /dev/hda (speed test) sdparm -i /dev/sdb cat /proc/ide/ide0/hda/model |
hdparm -i /dev/hda hdparm -I /dev/hda (detailed)haparm -Tt /dev/hda (speed test) sdparm -i /dev/sdb cat /proc/ide/ide0/hda/model |
diskinfo -v /dev/rdsk/c0t4d0 (detailed but no serial number) /opt/ignite/bin/print_manifest (no serial number)## Insure that the online diagnostic support tools have been installed swlist -l bundle | grep ‘Support Tools’ ## Command-Line Support Tools Manager (cstm) |
lscfg -vl hdisk0 lscfg -vl hdisk* |
Disk serial Number, type, etc |
Disk disk partitions | prtvtoc <device>
cat /etc/vfstab |
fdisk -l sfdisk -l (advanced server)cat /proc/partitions (very high level) cat /etc/fstab
|
fdisk -l sfdisk -l (advanced server)cat /proc/partitions (very high level) cat /etc/fstab |
lvlnboot -v /dev/vg00 lifls -Clv <device># Display the LIF contents lifcp /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 |
lsvg -l rootvg lchangelvcat /etc/filesystems |
Disk disk partitions |
List Raw Partitions | use format to partition the disk then just use the slice as a raw partition, remember to use the character device | ## Old way /etc/sysconfig/rawdevices service rawdevices start chkconfig rawdevices on## New way, Edit below file /etc/udev/rules.d/60-raw.rules udevinfo -d or udevadm info ## Display raw partitions |
mknod /dev/rawctl c 162 0 mknod /dev/raw/raw0 c 162 1 mknod /dev/raw/raw1 c 162 2 ln -s /dev/rawctl /dev/raw/rawctl## map raw devices to the disk raw /dev/raw/raw1 /dev/sdb1 ## display raw devices |
Just create a new LVOL without a filesystem – that’s it. | Just create a new LVOL without a filesystem
# create a raw volume
|
List Raw Partitions |
Bad Blocks | format (use analyse ) | badblocks | badblocks | dd if=/dev/rdsk/cXtYd0 of=/dev/null bs=1024K
Note: no errors means disk is good |
chlv -b [y|n] <lv>
Note: enables bad block relocation |
|
Filesystem commands | df -k df -h |
df -k df -h |
df -k df -h |
bdf df [-egiklnvfb] |
df -k lsfs [<filesystem>] lsfs -q <filesystem> (detailed) |
Filesystem commands |
Filesystem (create|remove) | newfs -v <raw device>
# Display how the filesystem was created |
mkfs -t ext3 /dev/sdb1 mke2fs -t ext4 /dev/sdb1# all point to mke2fs mkfs.ext2 mkfs.ext3 mkfs.ext4 cat /etc/mke2fs.conf |
mkfs -t ext3 /dev/sdb1 | newfs -F vxfs -o largefiles /dev/vg01/rlvol1
mkfs -F vxfs -o largefiles /dev/vg01/rlvol1 Note: mkfs and newfs are a pointer to /sbin/fs_wrapper |
crfs -v jfs2 -d data02lv -m /data02 -A yes
-v filesystem type rmfs -ri /data02 -r remove the mountpoint chfs -a size=+1G /var (grow by additional 1GB) |
Filesystem (create|remove|resize) |
Tune Filesystems | tunefs fstyp -v <device> |grep -i minfree |
tune2fs tune2fs -l /dev/sda1# change reserved blocks percentage to 1% tune2fs -m 1 /dev/sda1 |
tune2fs tune2fs -l /dev/sda1# change reserved blocks percentage to 1% tune2fs -m 1 /dev/sda1 |
tunefs -v <filesystem> vxtunefs -v <filesystem> fstyp -v <filesystem># Disk fragmentation fsadm -F vxfs -E / (report) fsadm -F vxfs -e / (defrag) |
chfs
Note: you can perform the following |
Tune Filesystems |
Force fsck |
# Check to see filesystem needs checking |
touch /forcefsck shutdown -Fr now fsck.mode=force (kernel parameter)tune2fs -l /dev/sdb<?> |grep -i ‘filesystem state’ |
touch /forcefsck shutdown -r nowtune2fs -l /dev/sdb<?> |grep -i ‘filesystem state’ # edit /etc/default/rcS change below so |
# Look at the second line to see if a filesystem |
n/a | Force fsck |
backup filesystem | ufsdump|ufsrestore tar dd cpio |
dump/restore tar dd cpio |
dump/restore tar dd cpio |
fbackup/frecover dump/restore ftio tar dd cpio |
backup|restore tar dd cpio |
backup filesystem |
Display the boot device | eeprom |grep boot-device prtconf -pv |grep bootpath prtpicl -v|grep ‘:bootpath’ |
cat /boot/grub/grub.conf cat /etc/lilo.confgrub = grand unified boot loader lilo = linux loader |
cat /boot/grub/menu.lst | setboot | bootinfo -b (display last boot device) bootlist -m [normal|service] -o (display bootable devices) |
Display the boot device |
Setting the boot device | setenv boot-device [<device>|<alias>] eeprom boot-device [<device>|<alias>] | /boot/grub/grub.conf /etc/lilo.conf |
/boot/grub/menu.lst | setboot -p <primary path> setboot -a <alternate path># autoboot sequnce setboot -b [on|off] |
bootlist -m normal hdisk0 hdisk1 | Setting the boot device |
Creating boot device (MBR) | installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk <raw-device> | grub-install <raw-device> lilo -v |
grub-install <raw-device> | mkboot -l <device>
Note: we are treating the disk as a LVM device |
bosboot -a (uses default device) bosboot -ad hdisk1 |
Creating boot device (MBR) |
Format floppy drive | fdformat -v -U volcheck -v newfs -v /vol/disk/aliases/floppy0 |
floppy –probe (use device obtained below ) floppy –createrc > /etc/fd0 floppy –format /dev/fd0 mkfs /dev/fd0 |
n/a | n/a | format -d /dev/rfd0 format -d /dev/fd0.18 (high format) |
Format floppy drive |
mount/unmount floppy | volrmmount -l floppy0 eject floppy |
mount /dev/fd0 /mnt/floppy umount /mnt/floppy |
n/a | n/a | mount /dev/rfd0 /floppy | mount/unmount floppy |
mount/unmount CDROM | mount -F hsfs -o ro <device path> /cdrom/cdrom0 umount /cdrom/cdrom0/etc/init.d/volmgr start eject cdrom |
mount -rt iso9660 /dev/cdrom /mnt/cdrom umount /mnt/cdrom eject cdrom |
mount -rt iso9660 /dev/cdrom /mnt/cdrom umount /mnt/cdrom eject cdrom |
mount -rF cdfs /dev/dsk/c1t6d0 /cdrom
start: /usr/sbin/pps_mountd |
mount -v cdrfs -r /dev/cd0 /cdrom umount /cdrom |
mount/unmount CDROM |
mount/umount ISO image | lofiadm -a <iso image> /dev/lofi/1 mount -F hsfs -o ro /dev/lofi/1 /mnt# to list lofiadm |
|||||
remount a filesystem | n/a | mount -o remount,rw / | mount -o remount,rw / | mount_vxfs -o remount,ro <filesystem> | mount -o remount,rw <filesystem>
Note:I did find a note that it should be possible to remount a jfs2 filesystem, but it did not work on my system |
remount a filesystem |
create boot disk or recovery tape | n/a | mkbootdisk `uname -r` (boot diskette) | n/a | recovery tape (preview) make_tape_recovery -v -l -x inc_entire=vg00 /opt/ignite/bin/make_recovery -ACv |
mksysb | create boot disk or recovery tape |
boot cdrom/diskette (single user) | ok> boot cdrom -s | using the grub window append the word singleto the kernel line | using the grub window append the word singleto the kernel line | enter PDC > search >boot p1 (cdrom) interact with IPL? Y ISL> hpux -is |
based on a 9114-275 workstation
|
boot cdrom/diskette (single user) |
boot into maintenace mode | ok> boot -as | f10 or f12 | f10 or f12 | >boot pri interact with IPL? Y ISL> hpux -lm |
based on a 9114-275 workstation
|
boot into maintenace mode |
Device paths | floppy:
disk: tape: cdrom: |
floppy: disk: tape: cdrom: |
floppy: /dev/fd0disk: /dev/hda or /dev/sda /dev/hdb or /dev/sdb tape: cdrom: |
floppy: n/adisk: /dev/dsk/c0t6d0 tape: cdrom: |
floppy: /dev/fd0 /dev/rfd0disk: /dev/hdisk0 tape: cdrom: |
Device paths |
update /dev directory | drvconfig devlinks disks|tapes|portsdevfsadm ( solaris 8, 9, 10) |
/dev/MAKEDEV <device> | /dev/MAKEDEV <device> | insf -C tape (Class)
insf -H 0.1.0 -e (recreate deleted link) |
cfgmgr cfgmgr -l scsi0mkdev |
update /dev directory |
remove or change a device | rem_drv | # remove all devices from a hardward path rmsf -k -H 52.6.0 |
rmdev rmdev -l cd0chdev chdev -l rmt0 -a ret=no |
remove or change a device | ||
list device drivers | prtconf -D sysdef |
cat /proc/devices | cat /proc/devices | lsdev | lsdev lsdev -Cc disk lsdev -Cc disk -p scsi0lsslot -c pci -l ent0 lscfg lspath -l hdisk0 getconf DISK_SIZE hdisk1 (detailed) |
list device drivers |
Solaris |
Red Hat |
Ubuntu/Debian |
HP |
AIX |
||
Basic network information (hostname, ip address) |
/etc/hostname.hme0 | /etc/sysconfig/network /etc/sysconfig/network-scripts/ifcfg-eth0 |
/etc/network/interfaces | /etc/rc.config.d/netconf | stores information in the ODM (Object Database Manager) | Basic network information (hostname, ip address) |
displaying network interfaces | prtdiag -v ifconfig -akstat hme:0:parameters:<param name> kstat e1000g:0:parameters:<param name> module:instance:name:statistics # Solaris 11 dladm show-phys ipadm show-if |
ifconfig system-config-network (GUI) |
ifconfig | ioscan -funC lan (list hardware) lanscan -v (list configured) ifconfig lan0 (individual) |
ifconfig -a
entstat -d <interface> lsdev -Cc if odmget -q “name=en0” CuAt lsattr -EHl en0 |
displaying network interfaces |
Configure network interface | ifconfig
# Solaris 11 – Automatic (using profiles) # Solaris 11 – Manual dladm create-vnic dladm create-etherstub ipadm create-ip net1 |
ifconfig | ifconfig | ifconfig <interface> | mktcpip (completely setup a network interface) rmtcpip (remove all network interfaces)# configure an interface mktcpip -h aix1 -a 192.168.1.200 -m 255.255.255.0 -i en1 -g 192.168.0.10 -h – hostname assigned to interface # remove an interface ifconfig (configures IP address) chdev (add aliases to network interface) |
Configure network interface |
Starting and stopping a network interface | ifconfig qfe0 up ifconfig qfe0 down |
/sbin/ifup eth0 /sbin/ifdown eth0 |
/sbin/ifup eth0 /sbin/ifdown eth0 |
ifconfig lan0 up ifconfig lan0 downnote: there is no “ifconfig -a” in hpux use lanscan then “ifconfig <interface>” |
ifconfig en0 up ifconfig en0 down ifconfig en0 detach (remove) |
Starting and stopping a network interface |
Setting NIC speed | ndd -set <device> <parm> <value> (dynamically) /etc/system (edit and update then reboot – permanent) |
mii-tool -F 100baseTx-FD eth0 ethtool -s eth1 speed 100 duplex full |
ethtool -s eth1 speed 100 duplex full | ndd -set <device> <parm> <value> lanadmin -X <option> lan0 |
chdev -l ent0 -a media_speed=1000_Full_Duplex -P chdev -l ent0 -a media_speed=Auto_Negotiation -PNote: entX – physical device enX – frame type run on entX |
Setting NIC speed |
Change NIC parameters | ndd -get <device> <parm>
# List parameters |
mii-tool -v ethtool eth1 ethtool -t eth0 onlinesysctl -a | grep net* |
ethtool eth0
sysctl -a |grep net* |
lanadmin -> lan -> display
## options supported |
netstat -v entstat -d <interface>no -a no -o “ipforwarding=1” |
NIC speeds or Parameters |
Display NIC statistics | netstat -i [-I interface] netstat -s | netstat -i [-f inet]
netstat -s entstat -d <interface> |
Display network statistics | |||
display MAC address | ifconfig -a (as user root) | ifconfig system-config-network (GUI) |
ifconfig | lanscan | netstat -ia | display MAC address |
Displaying network packets | snoop -d <interface> | tcpdump -i <interface>
ethereal (needs to be installed) |
tcpdump -i <interface>
ethereal (needs to be installed) |
nettl -start nettl -status all nettl -tn pduin pduout -e ns_ls_driver -file /var/adm/LAN nettl -stopuse netfmt to display the trace file |
tcpdump -i <interface> iptrace -i <interface> <output file> ipreport (used with iptrace to view reports) Note: you must stop the iptrace by using “kill -15” |
Displaying network packets |
default router | /etc/defaultrouter
route add default <gateway> |
edit /etc/sysconfig/network
add: GATEWAY=<IP address> |
edit /etc/network/interfaces
add: gateway <IP address> |
/etc/rc.config.d/netconf | route add 0 <gateway IP address>
Note: there is no file that holds the default router |
default router |
display routing table | netstat -rn | netstat -rn route -n |
netstat -rn route -n |
netstat -rn | netstat -rn netstat -r -f inet lsattr -EHl inet0 -a route |
display routing table |
Test IPMP, Bonding | if_mpadm -d (detach) if_mpadm -r (reattach)tail /var/adm/messages |
ifenslave -d bond0 eth1 (detach) ifenslave bond0 eth1 (reattach)cat /proc/net/bonding/bond0 # create bonding # modprobe # for bonding options – use BONDING_OPTS # see bonding mode |
ifenslave -d bond0 eth1 (detach) ifenslave bond0 eth1 (reattach)cat /proc/net/bonding/bond0 |
You buy an optional product called Auto-Port Aggragation. | smitty etherchannel (creates, deletes and tests)
entstat -d ent0 |
Test IPMP, Bonding |
change the hostname | change the following files:
/etc/nodename # Solaris 11 svcfg -s system/identity:node setprop config/nodename = astring: hostname |
/etc/sysconfig/network /etc/hostssysctl -a |grep hostname |
/etc/hostname /etc/hostssysctl -a |grep hostname |
set_parms hostname (requires reboot) | hostname <new hostname> chdev -l inet0 -a hostname=<hostname> |
change the hostname |
setup DNS | /etc/resolv.conf
# Solaris 11 – You need to use the svccfg command svcprop <pattern> Note: just use listprop on its own to view all options svccfg -s “dns/client” setprop “config/nameserver = net_address: (192.168.0.1)” |
/etc/resolv.conf | /etc/resolv.conf | /etc/resolv.conf | /etc/resolv.conf | setup DNS |
Name service switch file (DNS client) | /etc/nsswitch.conf /etc/resolv.conf# Solaris 11 – you need to use the svccfg command see above |
/etc/nsswitch.conf /etc/host.conf /etc/resolv.conf |
/etc/nsswitch.conf /etc/host.conf /etc/resolv.conf |
/etc/nsswitch.conf /etc/resolv.conf |
/etc/netsvc.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) |
Name service switch file (DNS client) |
Flush DNS cache | svcadm restart system/name-service-cache:default | ## if installed service nscd restart |
n/a | netcdctrl -t dns -e hosts -f | Flush DNS cache | |
Domain Name | /etc/defaultdomain | /etc/sysconfig/network (HOSTNAME option) /etc/resolv.confNote: for NIS use the NISDOMAIN option |
/etc/host /etc/resolv.conf |
/etc/rc.config.d/netconf | domainname <domainname> | Domain Name |
Obtain IP Address routing | route -n get <hostname> traceroute |
ip route get <IP address> traceroute |
ip route get <IP address> traceroute |
n/a | route -n get <hostname> | Obtain IP Address routing |
Find Services on the network | Boot (jumpstart) servers: rpcinfo -b bootparam 1NFS servers: rpcinfo -b mountd 1 NIS servers/slaves: |
Boot (jumpstart) servers: rpcinfo -b bootparam 1NFS servers: rpcinfo -b mountd 1 NIS servers/slaves: |
Boot (jumpstart) servers: rpcinfo -b bootparam 1NFS servers: rpcinfo -b mountd 1 NIS servers/slaves: |
Boot (jumpstart) servers: rpcinfo -b bootparam 1NFS servers: rpcinfo -b mountd 1 NIS servers/slaves: |
Boot (jumpstart) servers: rpcinfo -b bootparam 1NFS servers: rpcinfo -b mountd 1 NIS servers/slaves: |
Find Services on the network |
Solaris |
Red Hat |
Ubuntu/Debian |
HP |
AIX |
||
Crash Dump | dumpadm -d <device> coreadmcrash (used to analyse crash dumps) adb (used to analyse crash dumps) |
diskdump netdump kdump (part of kexec rpm)/etc/kdump.conf (select where you want the dump to go) service kdump start chkconfig kdump on ## to crash the system crash (used to analyse crash dumps) |
diskdump netdump kdump (part of kexec rpm)/etc/kdump.conf (select where you want the dump to go) service kdump start chkconfig kdump on ## to crash the system crash (used to analyse crash dumps) |
edit /stand/system
add either: # crash config file
|
sysdumpdev -l (list dump destination) sysdumpdev -e (estimates dumpsize) sysdumpdev -L (info)sysdumpstart -p (start dump primary) sysdumpstart -s (start dump secondary) # set the dump device permanently # analyse dump file |
Crash Dump |
Performance Monitoring and Diagnostics
Solaris |
Red Hat |
Ubuntu/Debian |
HP |
AIX |
||
CPU | top (sunfreeware) prstat sar mpstat w (load average) uptime (load average) ps vmstat |
top sar mpstat w (load average) uptime (load average) ps vmstat procinfo oprofile cat /proc/cpuinfo |
top sar mpstat w (load average) uptime (load average) ps vmstat procinfo cat /proc/cpuinfo |
top sar w (load average) uptime (load average) ps vmstat glance sam |
topas -P topas -L (logical partitions) mpstat sar -c w (load average) uptime (load average) lparstat ps iostat -tT 1 tprof curt |
CPU |
Memory | prstat vmstat top sar |
free vmstat top procinfo slabtop sar cat /proc/meminfo |
free vmstat top procinfo slabtop sar cat /proc/meminfo |
top vmstat sar sam glance |
topas vmstat sar -b svmon ps ipcs -a lockstat (version 4) rmss |
Memory |
Network | ndd netstat lsof snoop route |
ethtool mii-tool netstat lsof tcpdump ip iptraf nmap |
ethtool mii-tool netstat lsof tcpdump ip iptraf |
netstat lanadmin sam glance |
[ent|tok|fddi|atm]stat netstat netpmon (trcstop to stop trace) |
Network I/O |
Disk | sar -d iostat vmstat lsof |
sar -d iostat vmstat lsof |
sar -d iostat vmstat lsof |
iostat sar sam glance |
topas -D (disk) topas -F (filesystem) iostat sar -D fcstat (fibre) lvmstat filemon (trcstop to stop) fileplace# disk stat history chdev -l sys0 -a iostat=true lsattr -HEl sys0 -a iostat |
Disk I/O |
Application | truss -p <pid> ppriv -D -e <command> |
strace -p <pid> | strace -p <pid> | download and install tusc
tusc -p <pid> |
topas truss sar probevue tprof svmon -P <pid> |
Application |
NFS | nfsstat | nfsstat | nfsstat | nfsstat | nfsstat |
NFS |
Process | top prstat ps -ef pargs <pid> pcred <pid> pfiles <pid> pflags <pid> pgrep <pattern> pkill <pattern> pmap <pid> pldd <pid> preap <pid> prun <pid> psig <pid> pstack <pid> pstop <pid> ptime <pid> ptree <pid> pwait <pid> pwdx<pid> |
Solaris |
Red Hat |
Ubuntu/Debian |
HP |
AIX |
||
display loaded modules | modinfo | cat /proc/modules (more detailed) lsmod modinfo <module> Location: /lib/modules/`uname -r`/kernel/drivers Config: |
cat /proc/modules (more detailed) lsmodLocation: /lib/modules/`uname -r`/kernel/drivers Config: |
kmadmin -k | genkex | display loaded modules |
load modules | modload -p drv/<module name> | modprobe <module> insmod |
modprobe <module> insmod |
kmadmin -L <module name> | n/a | load modules |
unload modules | modunload -i <module number> | modprobe -r <module> rmmod |
modprobe -r <module> rmmod |
kmadmin -U <module name> kmadmin -u <module id> |
n/a | unload modules |
set kernel parameters (tuning) | /etc/system (edit and reboot) | /etc/sysctl.conf (edit and update then reboot) sysctl -p <filename>sysctl -w param=value No reboot (dynamically): |
/etc/sysctl.conf (edit and update then reboot) sysctl -p <filename>sysctl -w param=value No reboot (dynamically): |
kcweb (11i) kctune (11i only) rebuild kernel (< 11i see below) |
chdev -l sys0 -a <parameter>=<value> no -a (network) vmo -a (virtual memory) nfso -a (NFS) ioo -a (Input/Ouput) raso -a (reliability, availability, serviceability) schedo -a (processor scheduler)vi /etc/security/limits cd /etc/tunables tunchange, tundefault, tunsave, tunrestore, tuncheck Note: most parameters are dynamically changed in AIX , for example memory segments are dynamically adjusted |
set kernel parameters |
display kernel parameters | cat /etc/system sysdef -i |
sysctl -a cat /etc/sysctl.confcat /proc/sys/kernel/sem cat /proc/sys/kernel/shmmax etc…………………………….. |
sysctl -a cat /etc/sysctl.confcat /proc/sys/kernel/sem cat /proc/sys/kernel/shmmax etc…………………………….. |
kctune (11i only) sysdef kmtune kmsystem /usr/sam/lbin/getkinfo -f /stand/vmunix -o /tmp/kernel.data |
lsattr -EHl sys0
Note: only a few kernel parameters can be changed |
display kernel parameters |
build kernel | edit and update file then reboot: /etc/system |
cd /usr/src/linux-2.5 edit Makefile (change EXTRAVERSION) make mrproper backup .config make xconfig make dep make bzImage make modules move new kernel make modules_install change lilo/grub config file reboot |
cd /stand/build /usr/lbin/sysadm/system_prep -v -s system edit system file /usr/sbin/mk_kernel -s ./system mv /stand/system /stand/system.old mv /stand/vmunix /stand/vmunix.old mv /stand/build/system /stand mv /stand/build/vmunix_test /stand/vmunix reboot |
chdev -l sys0 -a <parameter>=<value>
Note: most parameters are dynamically changed in AIX , for example memory segments are dynamically adjusted |
build kernel | |
interprocess communication | ipcs -a | ipcs -a | ipcs -a | ipcs -a | ipcs -a | interprocess communication |
Solaris |
Red Hat |
Ubuntu/Debian |
HP |
AIX |
||
display services | svcs -a svcs -l <service> svcs -vx inetadm -l |
service –status-all | There is no services or chkconfig command use the old fashioned way /etc/init.d/<service> | There is no services or chkconfig command use the old fashioned way /sbin/init.d/<service> |
lssrc -a | display services |
start services | svcadm enable nfs | service nfs start | startsrc -s <subsystem> startsrc -g <group> |
start services | ||
stop services | svcadm disable nfs | service nfs stop | stopsrc -s <subsystem> stopsrc -g <group> |
stop services | ||
reload service | svcadm refresh nfs svcadm clear nfs (changes state) |
service nfs reload | refresh -s <subsystem> | reload service | ||
restart service | svcadm restart nfs | service nfs restart | stopsrc -s <subsystem> startsrc -s <subsystem> |
restart service | ||
service status | svcs nfs | service nfs staus | lssrc -a | service status | ||
service dependencies | svcs -d network | n/a | n/a | service dependencies | ||
service dependants | svcs -D network | n/a | n/a | service dependants | ||
Service notifications | # change or add svccfg# verify or confirm svcprop |
|||||
service logging, etc | /var/svc/log /var/svc/manifest /lib/svc/method /etc/svc/repository.db /system/volatile/svc_nonpersist.db |
n/a | /var/adm/ras /etc/syslog.conf /etc/rc.tcpip |
service logging, etc | ||
change service startup | n/a | chkconfig –levels 2345 nfs on | n/a | change service startup | ||
Add a new service | n/a | # Create your stop/start # script in /etc/init.dchkconfig –add <script> |
Solaris |
Red Hat |
Ubuntu/Debian |
HP |
AIX |
||
display installed patches | showrev -p patchadd -p |
swlist -l bundle swlist -l product swlist -l patch |
instfix -ia | display installed patches | ||
adding patch | patchadd patchadd -M <dir> (multiple patches) |
patch -p1 <patch>
zcat patch46.gz | patch -p1 Note: -p = # of path stripping |
swcopy (install patch into depot) swinstall (install patch from depot)Note: the swagentd daemon must be running |
instfix -k | adding patch | |
removing patch | patchrm | patch -R -p1 <patch> | swremove | installp -r | removing patch | |
display installed packages | pkginfo (all packages) pkginfo -l (single package) pkgchk -l -p <file> (file belongs)# NEW IPS pkg list (all packages) pkg info (single package) pkg search (find packages and files) |
rpm -qa (all packages) rpm -q (single package) rpm -qf (file belongs) rpm -qi <package> (very detailed) |
dpkg -l dpkg -S <search string> (search) dpkg -S <filename> (file belongs) dpkg -s <package> (status) dpkg -p <package> (detailed) |
swlist -l bundle <bundle> swlist -l product <product>## check a package swlist -s <full_path/software> |
lslpp -L all (all filesets) lslpp -L <package> (single fileset) lslpp -w <file> (file belongs) lslpp -ha (history of filesets)rpm -qa (all packages) rpm -q (single package) rpm -qf (file belongs) rpm -qi <package> (very detailed) oslevel -g (install packkages above os level) whereis <filename> |
display installed packages |
adding package | pkgadd
# NEW IPS |
rpm -Uhv (updates/installs if not already) rpm -ihv (install) |
dpkg -i <package> | swinstall swinstall -s <full_path/software> |
installp -a installp -c (cleanup after failed install)rpm -i geninstall (generic installer: installp, RPM, etc) |
adding package |
removing packages | pkgrm
# NEW IPS |
rpm -e <package> | dpkg -r <package> (do not remove config files) dpkg -P <package> (remove config files) |
swremove | installp -u (commited packages) installp -r (applied packages)rpm -e <package> geninstall -u <package> |
removing packages |
verify package | pkginfo -l pkginfo -p# NEW IPS pkg publisher pkg verify <package> |
rpm -V <package> | n/a | swverity <fileset> (see /var/adm/sw/swagent.log) | lppchk -v
rpm -V <package> |
verify package |
List files in package | pkgchk -l <package> | grep -i pathname
# NEW IPS |
rpm -ql <package> | dpkg -L <package> (list files) | swlist -l file <product> | lslpp -f <fileset>
rpm -ql <package> |
List files in package |
Other package commands | # NEW IPS pkg history pkg purge-history pkg freeze pkg unfreeze pkg fix pkg refresh pkg publisher |
|||||
Package directory | /var/sadm | /var/lib/rpm | /var/lib/dpkg/info | /var/adm/sw | /usr/lpp
/var/lib/rpm |
Package directory |
List libraries required for binary program | ldd <file> | ldd <file> | ldd <file> | chatr <file> | ldd <file> | List libraries required for binary program |
Solaris |
Red Hat |
Ubuntu/Debian |
HP |
AIX |
||
display users | cat /etc/passwd
logins -x [-p] |
cat /etc/passwd system-config-users (GUI) |
cat /etc/passwd | cat /etc/passwd logins -x |
cat /etc/passwd
lsuser -f ALL (detailed) |
display users |
create a user | useradd
# user defaults |
useradd system-config-users (GUI) |
useradd | useradd sam |
mkuser useradd |
create a user |
remove a user | userdel | userdel system-config-users (GUI) |
userdel | userdel sam |
rmuser userdel |
remove a user |
modify a user | usermod | usermod system-config-users (GUI) |
usermod | usermod sam |
chuser -a usermod passwd -f passwd -s chfn <username> chfn <username><shell> |
modify a user |
change user password | passwd | passwd | passwd | passwd | passwd pwdadm pwdck -t ALL |
change user password |
create a group | groupadd | groupadd | groupadd | groupadd | mkgroup <group name> | create a group |
remove a group | groupdel | groupdel | groupdel | groupdel | rmgroup <group name> | remove a group |
modify a goup | groupmod | groupmod | groupmod | groupmod | chgroup <attribute><group name> | modify a goup |
password files | /etc/passwd /etc/shadow |
/etc/passwd /etc/shadow |
/etc/passwd /etc/shadow |
/etc/passwd /tcb/files/auth/r/root (trusted system) |
/etc/security/passwd | password files |
useful user commands | id -a whoami who w finger logins -p |
id -a whoami who w finger |
id -a whoami who w finger |
id whoami who w uptime (displays # of users logged in) finger |
id whoami who w uptime (displays # of users logged in) finger# License information lslicense chlicense # Maximum number of processes for a user |
useful user commands |
useful group commands | groups setpgrp newgrp |
groups | groups | groups setprivgrp |
groups setgroups lsgroup ALL |
useful group commands |
Password Policy | /etc/security/policy.conf /etc/default/passwd |
/etc/login.defs | ||||
Password Aging | passwd | chage -l <user> chage <options> <user> |
Solaris |
Red Hat |
Ubuntu/Debian |
HP |
AIX |
||
NFS Daemons | server: mountd, nfsd client: statd, lockd |
server: rpc.mountd,nfsd client: rpc.statd, lockd |
server: rpc.mountd,nfsd client: rpc.statd, lockd |
server: rpc.mountd, nfsd client: rpc.statd, lockd |
server: rpc.mountd, nfsd client: rpc.statd, rpc.lockd |
NFS Daemons |
NFS files | /etc/dfs/dfstab /etc/dfs/sharetab /etc/rmtab |
/etc/exports /var/lib/nfs/etab /var/lib/nfs/xtab |
/etc/exports /var/lib/nfs/etab /var/lib/nfs/xtab |
/etc/exports /etc/xtab |
/etc/exports /etc/xtab |
NFS files |
List nfs clients that have a remote mount | /etc/rmtab | /var/lib/nfs/rmtab | /var/lib/nfs/rmtab | /etc/rmtab | /etc/xtab | List nfs clients that have a remote mount |
display nfs shares | dfshares showmount -e localhost |
showmount -e localhost | showmount -e localhost | showmount -e localhost | exportfs showmount -e localhost |
display nfs shares |
create nfs share | /etc/dfs/dfstab (edit and add share) share <path>## dfstab example share -F nfs -d “jumpstart” /export/jumpstart |
redhat-config-nfs (GUI)
/etc/exports (edit and add share) ## /etc/exports example |
/etc/exports (edit and add share, see below example) exportfs -rav (export the shares)/etc/init.d/portmap restart /etc/init.d/nfs-kernel-server restart ## /etc/exports example |
/etc/rc.config.d/nfsconf (edit) /etc/exports (edit and add share) exportfs -a |
mknfsexp -d <directory> mknfsmntshareall |
create nfs share |
uncreate nfs share | unshare <path> /etc/dfs/dfstab (edit and remove share) |
/etc/exports (edit and remove share) /sbin/service nfs reload |
/etc/exports (edit and remove share) exportfs -rav (export the shares) |
/etc/rc.config.d/nfsconf (edit) exportfs -au (unshare all) exportfs -u /home/vallep /etc/exports (edit and remove share) |
rmnfsexp -d <directory> (unshares and removes from file)
exportfs -u <filesystem> |
uncreate nfs share |
start/change nfs daemons | /etc/init.d/nfs.server start /etc/init.d/nfs.client startsvcadm enable nfs/server svcadm disable nfs/server |
/sbin/service nfs start | /etc/init.d/portmap start /etc/init.d/nfs-kernel-server start |
/sbin/init.d/nfs.core start /sbin/init.d/nfs.server start /sbin/init.d/nfs.client start |
mknfs chnfsstartsrc -s nfsd startsrc -s rpc.mountd |
start/change nfs daemons |
stop nfs daemons | /etc/init.d/nfs.server stop /etc/init.d/nfs.client stop |
/sbin/service nfs stop | /etc/init.d/portmap stop /etc/init.d/nfs-kernel-server stop |
/sbin/init.d/nfs.client stop /sbin/init.d/nfs.server stop /sbin/init.d/nfs.core stop |
rmnfs
stopsrc -s nfsd |
stop nfs daemons |
nfs status | ps -ef|grep < nfs daemons> | /sbin/service nfs status | /etc/init.d/nfs-kernel-server status | ps -ef | grep <nfs daemons> | lssrc -a |grep -i nfs | nfs status |
nfs reload | shareall | /sbin/service nfs reload | exportfs -rav (export the shares) | exportfs -a | exportfs -av | nfs reload |
nfs performanace | nfsstat | nfsstat | nfsstat | nfsstat | nfsstat | nfs performanace |
nfs Options | n/a | cat /var/lib/nfs/etab | cat /var/lib/nfs/etab | n/a | nfso -a nfso -o <option>=<value>exportfs (display options) |
nfs Options |
solaris/redhat mount problems (nfs v3 to v4) | ## Make sure you use NFS version 3 mount -F nfs -o vers=3 <mount> <mountpoint> |
n/a | n/a | n/a | n/a | solaris/redhat mount problems (nfs v3 to v4) |
Solaris |
Red Hat |
Ubuntu/Debian |
HP |
AIX |
||
Time daemons | xntpd | ntpd | ntpd | xntpd | xntpd | Time daemons |
ntp setup | # Solaris 8 /etc/ntp.conf /etc/ntp.server /etc/ntp.client/etc/rc2.d/xntpd [start|stop] # Solaris 10 svcadm enable ntpd |
/etc/ntp.conf (edit with ntp servers) dateconfig (GUI)chkconfig –list ntpd chkconfig –level 2345 ntpd on /sbin/service ntpd start |
/etc/default/ntp /etc/ntp.conf/etc/init.d/ntp [start|stop|restart] |
/etc/rc.config.d/netdaemons (set XNTPD to 1) /etc/ntp.conf |
/etc/ntp.conf
startsrc -s xntpd lslpp -L all|grep xntpd |
ntp setup |
ntp daemon options | /lib/svc/method/xntp | /etc/sysconfig/ntpd | /etc/default/ntp | /etc/rc.config.d/netdaemons | startsrc -s xntpd -a “-x”
/etc/rc.tcpip |
ntp daemon options |
NTP Trace commands | ntpq -p ntptrace |
ntpq -p ntptrace |
ntpq -p ntptrace |
ntpq -p ntpdate (set the date) |
ntpq -p ntptrace ntpdate |
NTP Trace commands |
Solaris |
Red Hat |
Ubuntu/Debian |
HP |
AIX |
||
messages | /var/adm/messages | /var/log/messages | /var/log/messages | /var/adm/syslog/syslog.log | /var/adm/ras |
messages |
syslog | /var/log/syslog | /var/log/syslog | /var/log/syslog | /var/adm/syslog/syslog.log | /var/adm/ras |
syslog |
/var/log/mail | /var/log/mail.* | /var/adm/syslog/mail.log | /usr/spool/mqueue/syslog |
|
||
cron | /var/cron/log | /var/log/cron | /var/log/cron.log | /var/adm/cron/log | /var/adm/cron/log |
cron |
boot | /var/adm/messages dmesg |
/var/log/boot dmesg |
/var/log/boot dmesg |
/var/adm/syslog/syslog.log dmesg |
/var/adm/ras
alog -o -t boot |
boot |
Error logging | logger | logger | logger | logger | /usr/lib/errdemon -l (display attributes) /usr/lib/errdemon (start error logging) /usr/lib/errstop (stop error logging)# use with above errorlog file errpt (summary errorlog report) errpt -a (detailed errorlog report) errpt -j <identifier> (single errorlog report) errclear (clears errorlog) errlogger “message upto 230 chars” |
Error logging |
Solaris |
Red Hat |
Ubuntu/Debian |
HP |
AIX |
||
Checking the passwd file | pwck | pwck | pwck | pwck | pwdck -t ALL usrck -t ALL |
Checking the passwd file |
checking the group file | grpck | grpck | grpck | grpck | grpck | checking the group file |
console login (allow/deny) | # Solaris 10 (no reboot) /etc/default/login# Solaris 11 (no reboot) /etc/default/login /etc/user_attr (see below) rolemod -K type=normal root |
# No reboot required /etc/securetty |
# No reboot required /etc/securetty |
# No reboot required /etc/securettyNote: you may need to create this file if it does not exist |
# No reboot required /etc/security/userchsec -f /etc/security/user -s root |
console login (allow/deny) |