You are on page 1of 8

Unix Commands

http://www.datadisk.co.uk/html_docs/misc/unix_...

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

sysinfo
Solaris

Red Hat

cat /etc/release

cat /etc/enterprise-release
cat /etc/redhat-release

Ubuntu/Debian
cat /etc/lsb-release

HP-UX

AIX

/stand/kernrel

lsb_release -a
Server Release info

oslevel -r

lsb_release -a

Server Release info

cat /proc/version
/usr/platform/`uname -i`/sbin/prtdiag -v

dmidecode

dmidecode

prtconf | grep -i 'System Model'


model
uname -a

Server type
lspci
lsusb
lshal

lspci
lsusb
lshal

prtdiag -v
prtconf -D
prtpicl -v [-c <class>]
picl = platform information and control
library

Server type

lscfg -v
lscfg -l ent0
lscfg -vl fcs0 (find the WWN of HBA adapter)

ioscan
ioscan -fun [disk|tape|lan]
/opt/ignite/bin/print_manifest
cat /var/opt/ignite/local/manifest/manifest.info

Note: hal = hardware abstraction layer

Hardware Info

lsdev
lsdev -Cc disk
lsdev -Cc disk -p scsi0

Hardware Info

lsslot -c [pci|phb|port]
lsslot -c pci -l ent0
lspath -l hdisk0
diag
uname -a

Operating System

/usr/platform/`uname -i`/sbin/prtdiag -v
prtconf | grep -i mem

uname -a

uname -a

uname -a

oslevel [-r|-s]

Operating System

cat /proc/meminfo (detailed)


free -om

cat /proc/meminfo (detailed)


free -om

dmesg | grep -i physical


/usr/sam/lbin/getmem
/opt/ignite/bin/print_manifest

Memory

cat /proc/slabinfo

cat /proc/slabinfo

prtconf -m
prtconf |grep -i memory
lsattr -El sys0 -a realmem
bootinfo -r

Memory

cat /var/opt/ignite/local/manifest/manifest.info
cat /proc/cpuinfo (detailed)

cat /proc/cpuinfo (detailed)

## display,offline,online
psrinfo
psradm -f 0 (offline)
psradm -n 0 (online)

CPU (type, number, etc)

format -e (to convert EFI (zfs) to SMI)


Note:
EFI - Extensible Firmware Interface
SMI - Sun Microsystems Inc

fdisk -l
sfdisk -l (advanced server)
parted <device> print
partprobe -s <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

smartctl -a <device>

/boot/initrd.?????.img
/boot/vmlinuz

/kernel/genunix

/boot/initrd.img-?????-server
/boot/vmlinuz-????-server

/stand/vmunix

/unix
/usr/lib/boot
/usr/lib/drivers

/platform/`uname -m`/kernel
/platform/i86pc/kernel
/kernel
/usr/kernel

Kernel File and associated


directories

CPU (type, number, etc)

cat /var/opt/ignite/local/manifest/manifest.info

format
prtvtoc <device>
Disk Drives

prtconf |grep -i processor


/opt/ignite/bin/print_manifest
sam -> performance monitors -> system properties

/usr/platform/`uname -i`/sbin/prtdiag -v

Kernel File

Note: /unix - symbolic link to kernel file i.e /usr/lib


/boot/unix_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'

prtconf -k
bootinfo -K

HPUX < version 11 all 32 bit


Kernel 32 or 64

Kernel 32 or 64

Note: determine if system supports 64 bit


getconf HW_CPU_SUPP_BITS
/opt/ignite/bin/print_manifest |grep -i 'hw capability'

At the OK prompt type banner

boot into the BIOS (normally F2 or F12)

boot into the BIOS (normally F2 or F12)

prtconf |grep -i firmware


lscfg -pv
invscout

workstations:
reboot
enter PDC
type: IN (information menu)
type: FV (Firmware Version)

Display Firmware

n/a

/proc/interrupts
/proc/ioports
/proc/dma

/proc/interrupts
/proc/ioports
/proc/dma

n/a

prtconf

admintool

linuxconf

linuxconf

sam

smit
smitty

Display IRQ, IO ports and DMA

GUI admin tool

Display Firmware

Display IRQ, IO ports and


DMA
GUI admin tool

Memory and Swap


Solaris

Memory

/usr/platform/`uname -i`/sbin
/prtdiag -v
prtconf | grep -i mem

Red Hat
cat /proc/meminfo (detailed)
free -om

Ubuntu/Debian
cat /proc/meminfo (detailed)
free -om

HP
dmesg | grep -i physical
/usr/sam/lbin/getmem
/opt/ignite/bin/print_manifest

AIX
prtconf -m
prtconf |grep -i memory
lsattr -El sys0 -a realmem
bootinfo -r

Memory

cat /var/opt/ignite/local/manifest/manifest.info
page size
(memory)
display swap

/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)

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
mkps -a -s 4 -n <volume group>

device:
create partition with fdisk (type 82)
file(create 50MB swap file):
dd if=/dev/zero of=/var/swapfile
bs=1024 count=50000

device:
create partition with fdisk (type 82)
file(create 50MB swap file):
dd if=/dev/zero of=/var/swapfile
bs=1024 count=50000

Create logical volume or filesystem

mkfile 5m /var/swapfile
swap -a /var/swapfile

swapon <device> | -f <logical device>


swapon -p 3 <device> | -f <logical device>

# change the attributes


chps -a n paging00 (don't use after restart)

update /etc/fstab

# change the logical volume attributes (name in this case)


chlv -n <new name> <old old> (chang page space name)

update /etc/vfstab
adding swap

mkswap <device>|<file>
swapon <device>|<file>

mkswap <device>|<file>
swapon <device>|<file>
update /etc/fstab

update /etc/fstab

1 of 8

Note: -p = priority swap number . The nswapdev


tunable system parameter controls the maximum
number of swap devices.

page size (memory)

display swap

adding swap

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

04/28/2014 04:32 PM

Unix Commands

http://www.datadisk.co.uk/html_docs/misc/unix_...

also see /etc/swapspaces file


removing
swap

update /etc/vfstab
swap -d

swapoff <device>|<file>

swapoff <device>|<file>

Remove device or file as normal

Remove device or file as normal

remove entry from /etc/fstab


reboot

swapoff /dev/paging00
rmps paging00

removing swap

Note: paging space must be deactiviated before removing

Disks, Filesystems and Devices


Solaris

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 discovery

Red Hat
fdisk -l
sfdisk -l (advanced server)
parted <device> print
partprobe <device>

Ubuntu/Debian
fdisk -l
sfdisk -l (advanced server)
parted <device> print
partprobe <device>

HP
ioscan -funC disk

AIX
lsdev -Cc disk
lsdev -Cc disk -p scsi0 (specific controller)
lsdev -Cc disk -S [a|d|s] (available, defined,stopped)
lscfg -v -l hdisk0

udevadm info -q all -n /dev/sda1


blkid
dmsetup [ls|info]

Disk Drives

format -e (to convert EFI (zfs) to SMI)


Note:
EFI - Extensible Firmware Interface
SMI - Sun Microsystems Inc
format
iostat -En
luxadm inq <disk> (A5x00 disk arrays)

Disk serial Number, type,


etc

hdparm -i /dev/hda
hdparm -I /dev/hda (detailed)

hdparm -i /dev/hda
hdparm -I /dev/hda (detailed)

hdparm -Tt /dev/hda (speed test)

haparm -Tt /dev/hda (speed test)

sdparm -i /dev/sdb

sdparm -i /dev/sdb

cat /proc/ide/ide0/hda/model
cat /proc/scsi/scsi

cat /proc/ide/ide0/hda/model
cat /proc/scsi/scsi

fdisk -l
sfdisk -l (advanced server)

fdisk -l
sfdisk -l (advanced server)

lvlnboot -v /dev/vg00
lifls -Clv <device>

lsvg -l rootvg
lchangelv

cat /proc/partitions (very high level)


cat /etc/fstab

cat /proc/partitions (very high level)


cat /etc/fstab

# Display the LIF contents


lifcp /dev/dsk/c0t6d0:AUTO -

cat /etc/filesystems

diskinfo -v /dev/rdsk/c0t4d0 (detailed but no serial


number)
/opt/ignite/bin/print_manifest (no serial number)

lscfg -vl hdisk0


lscfg -vl hdisk*

## Insure that the online diagnostic support tools have


been installed
swlist -l bundle | grep 'Support Tools'
Disk serial Numbe

## Command-Line Support Tools Manager (cstm)


## The run cstm
cstm
cstm> map
cstm> sel dev 4
(select the disk of you choice)
cstm> info
cstm> il
(obtain the serial number)
cstm> quit

prtvtoc <device>
cat /etc/vfstab

cat /etc/fstab

Disk disk partitions

Disk disk partitions

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.
use format to partition the disk then just use the
## Old way
slice as a raw partition, remember to use the
/etc/sysconfig/rawdevices
character device
service rawdevices start
chkconfig rawdevices on
## New way, Edit below file
/etc/udev/rules.d/60-raw.rules
udevinfo -d or udevadm info

List Raw Partitions

## Display raw partitions


raw -qa
format (use analyse )

badblocks

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

Just create a new LVOL without a filesystem - that's it.


Just create a new LVOL without a filesystem
# create a raw volume
mklv -y rawVolume vg01 10

## map raw devices to the disk


raw /dev/raw/raw1 /dev/sdb1

List Raw Partitions

## display raw devices


raw -qa

badblocks

dd if=/dev/rdsk/cXtYd0 of=/dev/null bs=1024K

chlv -b [y|n] <lv>

Note: no errors means disk is good

Note: enables bad block relocation

df -k
df -h

bdf
df [-egiklnvfb]

df -k
lsfs [<filesystem>]
lsfs -q <filesystem> (detailed)

mkfs -t ext3 /dev/sdb1

newfs -F vxfs -o largefiles /dev/vg01/rlvol1

Bad Blocks

Filesystem commands

df -k
df -h

df -k
df -h

newfs -v <raw device>


# Display how the filesystem was created
newfs -Nv <filesystem>

mkfs -t ext3 /dev/sdb1


mke2fs -t ext4 /dev/sdb1

crfs -v jfs2 -d data02lv -m /data02 -A yes


mkfs -F vxfs -o largefiles /dev/vg01/rlvol1

# all point to mke2fs


mkfs.ext2
mkfs.ext3
mkfs.ext4

Filesystem (create|remove)

Filesystem comm

Note: mkfs and newfs are a pointer to


/sbin/fs_wrapper

-v filesystem type
-d device or logical volume
-m mountpoint
-A mount after restart [yes|no]
Filesystem (crea

rmfs -ri /data02


cat /etc/mke2fs.conf
-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)
tunefs
fstyp -v <device> |grep -i minfree

Tune Filesystems

tune2fs
tune2fs -l /dev/sda1

tune2fs
tune2fs -l /dev/sda1

# change reserved blocks percentage to 1%


tune2fs -m 1 /dev/sda1

# change reserved blocks percentage to 1%


tune2fs -m 1 /dev/sda1

touch /forcefsck
shutdown -Fr now
fsck.mode=force (kernel parameter)
Force fsck

backup filesystem

Display the boot device

# Check to see filesystem needs checking


fstyp -v <filesystem> | grep fsclean

tunefs -v <filesystem>
vxtunefs -v <filesystem>
fstyp -v <filesystem>
# Disk fragmentation
fsadm -F vxfs -E / (report)
fsadm -F vxfs -e / (defrag)

touch /forcefsck
shutdown -r now

tune2fs -l /dev/sdb<?> |grep -i 'filesystem state'

chfs
Note: you can perform the following
resize
freeze
change mountpoint
permissions
lots more..............................

Tune Filesystem

n/a

Force fsck

# Look at the second line to see if a filesystem


# needs checking
tunefs -v <filesystem>

tune2fs -l /dev/sdb<?> |grep -i 'filesystem state'

# edit /etc/default/rcS change below so


# you dont have to hang around
FSCKFIX=yes

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

eeprom |grep boot-device


prtconf -pv |grep bootpath
prtpicl -v|grep ':bootpath'

cat /boot/grub/menu.lst

setboot

cat /boot/grub/grub.conf
cat /etc/lilo.conf

bootinfo -b (display last boot device)


bootlist -m [normal|service] -o (display bootable devices)

backup filesystem

Display the boot d


grub = grand unified boot loader
lilo = linux loader

setenv boot-device [<device>|<alias>]


eeprom boot-device [<device>|<alias>]
Setting the boot device

/boot/grub/menu.lst
/boot/grub/grub.conf
/etc/lilo.conf

setboot -p <primary path>


setboot -a <alternate path>

bootlist -m normal hdisk0 hdisk1


Setting the boot dev

# autoboot sequnce
setboot -b [on|off]

installboot /usr/platform/`uname -i`/lib/fs/ufs


Creating boot device (MBR) /bootblk <raw-device>

grub-install <raw-device>
lilo -v

grub-install <raw-device>

mkboot -l <device>

bosboot -a (uses default device)


bosboot -ad hdisk1

Creating boot d

Note: we are treating the disk as a LVM device

Format floppy drive

mount/unmount floppy

mount/unmount CDROM

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)

volrmmount -l floppy0
eject floppy

mount /dev/fd0 /mnt/floppy


umount /mnt/floppy

n/a

n/a

mount /dev/rfd0 /floppy

mount -rt iso9660 /dev/cdrom /mnt/cdrom


umount /mnt/cdrom
eject cdrom

mount -rF cdfs /dev/dsk/c1t6d0 /cdrom

mount -v cdrfs -r /dev/cd0 /cdrom


umount /cdrom

mount -F hsfs -o ro <device path> /cdrom


/cdrom0
umount /cdrom/cdrom0
/etc/init.d/volmgr start
eject cdrom

2 of 8

mount -rt iso9660 /dev/cdrom /mnt/cdrom


umount /mnt/cdrom
eject cdrom

start: /usr/sbin/pps_mountd
pps_mount

Format floppy drive

mount/unmount flo

mount/unmount CDROM

04/28/2014 04:32 PM

Unix Commands

http://www.datadisk.co.uk/html_docs/misc/unix_...

lofiadm -a <iso image> /dev/lofi/1


mount -F hsfs -o ro /dev/lofi/1 /mnt
mount/umount ISO image
# to list
lofiadm
n/a

mount -o remount,rw /

mount -o remount,rw /

mount_vxfs -o remount,ro <filesystem>


mount -o remount,rw <filesystem>

remount a filesystem

create boot disk or


recovery tape

Note:I did find a note that it should be possible to remount a


jfs2 filesystem, but it did not work on my system
n/a

mkbootdisk `uname -r` (boot diskette)

n/a

ok> boot cdrom -s

using the grub window append the word single to


the kernel line

using the grub window append the word single to enter PDC
the kernel line
> search
>boot p1 (cdrom)
interact with IPL? Y
ISL> hpux -is

based on a 9114-275 workstation

f10 or f12

>boot pri
interact with IPL? Y
ISL> hpux -lm

based on a 9114-275 workstation

floppy:
/dev/fd0
/dev/rfd0

boot cdrom/diskette (single


user)

ok> boot -as

f10 or f12

recovery tape (preview)


make_tape_recovery -v -l -x inc_entire=vg00
/opt/ignite/bin/make_recovery -ACv

remount a filesys

mksysb
create boot disk or r

1. Restart the machine.


2. Wait the the AIX splash screen to come up. Devices
begin to initialize here.
boot cdrom/disk
3. 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.

1. 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 boot into mainte
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

boot into maintenace mode

floppy:
floppy:
/dev/fd0

floppy:
/dev/fd0

floppy:
n/a

disk:
/dev/hda or /dev/sda
/dev/hdb or /dev/sdb

disk:
/dev/hda or /dev/sda
/dev/hdb or /dev/sdb

disk:
/dev/dsk/c0t6d0

cdrom:
/dev/dsk/c0t6d0s0
/dev/scd0 (external usb cd)

tape:

tape:

tape:
/dev/dsk/rmt/0

tape:

cdrom:
/dev/hda (depends on number of IDE disks)

cdrom:
/dev/hda (depends on number of IDE disks)

cdrom:
/dev/dsk/c1t6d0

cdrom:
/dev/cd0

drvconfig
devlinks
disks|tapes|ports

/dev/MAKEDEV <device>

/dev/MAKEDEV <device>
insf -C tape (Class)

cfgmgr
cfgmgr -l scsi0

disk:
/dev/dsk/c0t0d0s0

Device paths

update /dev directory

tape:
/dev/rmt/0ucb

disk:
/dev/hdisk0
Device paths

update /dev dire

insf -H 0.1.0 -e (recreate deleted link)


mkdev

devfsadm ( solaris 8, 9, 10)


rem_drv

# remove all devices from a hardward path


rmsf -k -H 52.6.0

rmdev
rmdev -l cd0

remove or change a device

remove or change a
chdev
chdev -l rmt0 -a ret=no
prtconf -D
sysdef

cat /proc/devices

cat /proc/devices

lsdev
lsdev
lsdev -Cc disk
lsdev -Cc disk -p scsi0
lsslot -c pci -l ent0
lscfg
lscfg -l ent0
lscfg -vl fcs0 (find the WWN of HBA adapter)

list device drivers

list device drive

lspath -l hdisk0
getconf DISK_SIZE hdisk1 (detailed)

Networking
Solaris
Basic network information
(hostname, ip address)

/etc/hostname.hme0

prtdiag -v
ifconfig -a

Red Hat

Ubuntu/Debian

HP

AIX

/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)

ifconfig
system-config-network (GUI)

ifconfig

ioscan -funC lan (list hardware)


lanscan -v (list configured)
ifconfig lan0 (individual)

ifconfig -a

Basic network
information
(hostna

entstat -d <interface>

kstat hme:0:parameters:<param name>


kstat e1000g:0:parameters:<param name>

lsdev -Cc if
lsdev -Cc tcpip

module:instance:name:statistics

odmget -q "name=en0" CuAt

# Solaris 11
netadm list

lsattr -EHl en0


displaying network
interface

displaying network interfaces


dladm show-phys
dladm show-link
dladm show-linkprop
dladm show-vnic
dladm show-etherstub
ipadm show-if
ipadm show-ifprop
ipadm show-addr
ipadm show-addrprop
ifconfig

ifconfig

ifconfig <interface>

ifconfig

mktcpip (completely setup a network interface)


rmtcpip (remove all network interfaces)

# Solaris 11 - Automatic (using profiles)


netadm enable -p ncp Automatic
netcfg
(use by Automatic)

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

# Solaris 11 - Manual
netadm enable -p ncp DefaultFixed
netcfg
Configure network interface

-h - hostname assigned to interface


-a - ip address
-m - netmask
-i - interface name
-g - gateway ip address

dladm create-vnic
dladm delete-vnic
dladm rename-link

# remove an interface
ifconfig en1 detach

dladm create-etherstub
ipadm create-ip net1
ipadm create-addr -T static -a 192.168.0.110/24 net1/pfv
ipadm delete-ip
ipadm delete-addr
ifconfig qfe0 up
ifconfig qfe0 down

ifconfig (configures IP address)


chdev (add aliases to network interface)

/sbin/ifup eth0
/sbin/ifdown eth0

/sbin/ifup eth0
/sbin/ifdown eth0

Starting and stopping a network


interface

ifconfig lan0 up
ifconfig lan0 down

ifconfig en0 up
ifconfig en0 down
ifconfig en0 detach (remove)

note: there is no "ifconfig -a" in hpux use lanscan then


"ifconfig <interface>"
ndd -set <device> <parm> <value> (dynamically)
/etc/system (edit and update then reboot - permanent)

Configure
interface

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

Setting NIC speed

Starting and stopping a


network in

chdev -l ent0 -a media_speed=1000_Full_Duplex -P


chdev -l ent0 -a media_speed=Auto_Negotiation -P
Note:
entX - physical device
enX - frame type run on entX

Setting NIC spe

ethtool eth0
ndd -get <device> <parm>
Change NIC parameters

3 of 8

# List parameters
ndd -get /dev/hme \?
ndd -get /dev/e1000g0 \?

mii-tool -v
ethtool eth1
ethtool -t eth0 online
sysctl -a | grep net*

lanadmin -> lan -> display


sysctl -a |grep net*
## options supported
ndd -get /dev/ip ?
ndd -get /dev/tcp ?

netstat -v
entstat -d <interface>
NIC spee
no -a
no -o "ipforwarding=1"

04/28/2014 04:32 PM

Unix Commands

http://www.datadisk.co.uk/html_docs/misc/unix_...

ndd -get /dev/ip \?


ndd -get /dev/tcp \?

ndd -get /dev/arp ?


ndd -get /dev/udp ?

Display NIC statistics


ifconfig -a (as user root)

display MAC address

netstat -i [-I interface]


netstat -s

netstat -i [-f inet]


netstat -s
entstat -d <interface>

Display n

ifconfig
system-config-network (GUI)

ifconfig

lanscan

netstat -ia

tcpdump -i <interface>

tcpdump -i <interface>

ethereal (needs to be installed)

ethereal (needs to be installed)

nettl -start
nettl -status all
nettl -tn pduin pduout -e ns_ls_driver -file
/var/adm/LAN
nettl -stop

tcpdump -i <interface>
iptrace -i <interface> <output file>
ipreport (used with iptrace to view reports)

display MAC a

snoop -d <interface>

Displaying network packets

Displayin
packets

Note: you must stop the iptrace by using "kill -15"


use netfmt to display the trace file
edit /etc/network/interfaces

/etc/defaultrouter

/etc/rc.config.d/netconf

route add 0 <gateway IP address>

edit /etc/sysconfig/network
default router

route add default <gateway>


route -p add default <gateway> (persist changes)
netstat -rn

netstat -rn
route -n

display routing table

if_mpadm -d
if_mpadm -r

(detach)
(reattach)

tail /var/adm/messages

Note: there is no file that holds the default router

default router

netstat -rn

netstat -rn
netstat -r -f inet
lsattr -EHl inet0 -a route

display ro

You buy an optional product called Auto-Port


Aggragation.

smitty etherchannel (creates, deletes and tests)

add: gateway <IP address>

add: GATEWAY=<IP address>

netstat -rn
route -n

ifenslave -d bond0 eth1 (detach)


ifenslave bond0 eth1
(reattach)

ifenslave -d bond0 eth1 (detach)


ifenslave bond0 eth1
(reattach)

cat /proc/net/bonding/bond0

cat /proc/net/bonding/bond0

entstat -d ent0

# create bonding
/etc/sysconfig/network-scripts/ifcfg-bond0
Test IPMP, Bonding

Test IPMP

# modprobe
/etc/modprobe.d/bonding.conf
# for bonding options - use BONDING_OPTS
/etc/sysconfig/network-scripts/ifcfg-bond0
# see bonding mode
cat /sys/class/net/bond0/bonding/mode

change the following files:


/etc/nodename
/etc/hostname.<interface>
/etc/inet/hosts
/etc/inet/ipnodes
/etc/net - few files in here as well

/etc/sysconfig/network
/etc/hosts

/etc/hostname
/etc/hosts

sysctl -a |grep hostname

sysctl -a |grep hostname

set_parms hostname (requires reboot)

hostname <new hostname>


chdev -l inet0 -a hostname=<hostname>

change th

change the hostname


# Solaris 11
svccfg -s system/identity:node listprop config/nodename
svcfg -s system/identity:node setprop config/nodename =
astring: hostname
svcadm refresh system/identity:node
svcadm restart indentity:node
/etc/resolv.conf

/etc/resolv.conf

/etc/resolv.conf

/etc/resolv.conf

/etc/resolv.conf
# Solaris 11 - You need to use the svccfg command
svccfg -s dns/client listprop config/nameserver
svccfg -s dns/client listprop config/search
svccfg -s name-service/switch listprop config/host
svccfg -s name-service/switch listprop config/password
svcprop <pattern>
setup DNS

setup DNS

Note: just use listprop on its own to view all options


svccfg -s "dns/client" setprop "config/nameserver =
net_address: (192.168.0.1)"
svccfg -s "dns/client" setprop 'config/domain = astring:
("datadisk.co.uk")'
svccfg -s "name-service/switch" setprop 'config/host =
astring: "file dns"'
svcadm refresh name-service/switch
svcadm refresh dns/client
/etc/nsswitch.conf
/etc/host.conf
/etc/resolv.conf

/etc/nsswitch.conf
/etc/resolv.conf

Name service switch file (DNS


client)

/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)

# Solaris 11 - you need to use the svccfg command


see above

Flush DNS cache

chnamsv (change name service)


rmnamsv (remove a name service)
lsnamsv -C (list name services)

svcadm restart system/name-service-cache:default

## if installed
service nscd restart

/etc/defaultdomain

/etc/sysconfig/network (HOSTNAME option)


/etc/resolv.conf

Domain Name

n/a

netcdctrl -t dns -e hosts -f

/etc/host
/etc/resolv.conf

/etc/rc.config.d/netconf

domainname <domainname>

Name serv
(DNS client)

Flush DNS c

Domain Na

Note: for NIS use the NISDOMAIN option


Obtain IP Address routing

Find Services on the network

route -n get <hostname>


traceroute

ip route get <IP address>


traceroute

ip route get <IP address>


traceroute

n/a

route -n get <hostname>

Boot (jumpstart) servers:


rpcinfo -b bootparam 1

Boot (jumpstart) servers:


rpcinfo -b bootparam 1

Boot (jumpstart) servers:


rpcinfo -b bootparam 1

Boot (jumpstart) servers:


rpcinfo -b bootparam 1

Boot (jumpstart) servers:


rpcinfo -b bootparam 1

NFS servers:
rpcinfo -b mountd 1

NFS servers:
rpcinfo -b mountd 1

NFS servers:
rpcinfo -b mountd 1

NFS servers:
rpcinfo -b mountd 1

NFS servers:
rpcinfo -b mountd 1

NIS servers/slaves:
rpcinfo -b ypserv 1

NIS servers/slaves:
rpcinfo -u <yp server> ypserv

NIS servers/slaves:
rpcinfo -u <yp server> ypserv

NIS servers/slaves:
rpcinfo -b ypserv 1

NIS servers/slaves:
rpcinfo -b ypserv 1

Obtain IP Addre

Find Serv
network

Crash Dump
Solaris

Crash Dump

Red Hat

Ubuntu/Debian

dumpadm -d
<device>
coreadm

diskdump
netdump
kdump (part of kexec rpm)

diskdump
netdump
kdump (part of kexec rpm)

crash (used to
analyse crash dumps)
adb (used to analyse
crash dumps)

/etc/kdump.conf (select where you


want the dump to go)
service kdump start
chkconfig kdump on

/etc/kdump.conf (select where you


want the dump to go)
service kdump start
chkconfig kdump on

## to crash the system


echo "c" > /proc/sysrq-trigger

## to crash the system


echo "c" > /proc/sysrq-trigger

HP
edit /stand/system
add either:
dump 2/0/1.5.0
dump lvol
dump none

AIX
sysdumpdev -l (list dump destination)
sysdumpdev -e (estimates dumpsize)
sysdumpdev -L (info)
sysdumpstart -p (start dump primary)
sysdumpstart -s (start dump secondary)
Crash Dump

# crash config file


/etc/rc.config.d/savecrash

# set the dump device permanently


sysdumpdev -p <dump device> -P
# analyse dump file
echo "stat\n status\n t -m" | crash /var/adm/ras/vmcore.0

crash (used to analyse crash dumps) crash (used to analyse crash dumps)

Performance Monitoring and Diagnostics


Solaris

CPU

4 of 8

top (sunfreeware)
prstat
sar
mpstat
w
(load average)
uptime (load average)
ps
vmstat

Red Hat
top
sar
mpstat
w
(load average)
uptime (load average)
ps
vmstat
procinfo
oprofile
cat /proc/cpuinfo

Ubuntu/Debian
top
sar
mpstat
w
(load average)
uptime (load average)
ps
vmstat
procinfo
cat /proc/cpuinfo

HP
top
sar
w
(load average)
uptime (load average)
ps
vmstat
glance
sam

AIX
topas -P
topas -L (logical partitions)
mpstat
sar -c
w
(load average)
uptime (load average)
lparstat
ps
iostat -tT 1
tprof
curt

CPU

04/28/2014 04:32 PM

Unix Commands

Memory

Network

http://www.datadisk.co.uk/html_docs/misc/unix_...

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

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)

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

Memory

Network I/O

Disk

Disk I/O

# disk stat history


chdev -l sys0 -a iostat=true
lsattr -HEl sys0 -a iostat
truss -p <pid>
ppriv -D -e <command>

strace -p <pid>

strace -p <pid>

download and install tusc


topas
truss
sar
probevue
tprof
svmon -P <pid>

tusc -p <pid>
Application

NFS

nfsstat

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>

nfsstat

nfsstat

nfsstat

Application

nfsstat

NFS

Kernel Modules and Parameters


Solaris
modinfo

Red Hat

Ubuntu/Debian
cat /proc/modules (more detailed)
lsmod

cat /proc/modules (more detailed)


lsmod
modinfo <module>
Location:
/lib/modules/`uname -r`/kernel/drivers

display loaded
modules

Location:
/lib/modules/`uname -r`/kernel/drivers
display loaded modu

modload -p drv/<module name>

modprobe <module>
insmod

modprobe <module>
insmod

modunload -i <module number>

modprobe -r <module>
rmmod

modprobe -r <module>
rmmod

/etc/sysctl.conf (edit and update then reboot)


sysctl -p <filename>

/etc/sysctl.conf (edit and update then reboot)


sysctl -p <filename>

sysctl -w param=value

sysctl -w param=value

No reboot (dynamically):
echo "250 32000 100 28" > /proc/sys/kernel/sem
echo "536870912" > /proc/sys/kernel/shmmax
echo "4096" > /proc/sys/kernel/shmmni
echo "2097152" > /proc/sys/kernel/shmall
etc.............................................

No reboot (dynamically):
echo "250 32000 100 28" > /proc/sys/kernel/sem
echo "536870912" > /proc/sys/kernel/shmmax
echo "4096" > /proc/sys/kernel/shmmni
echo "2097152" > /proc/sys/kernel/shmall
etc.............................................

unload modules
/etc/system (edit and reboot)

set kernel parameters


(tuning)

AIX
genkex

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

Config:
/etc/modprobe.conf
/etc/modprobe.d
load modules

HP
kmadmin -k

kmadmin -L <module name>

n/a

load modules

n/a
kmadmin -U <module name>
kmadmin -u <module id>

unload modules

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)
set kernel para
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

cat /etc/system
sysdef -i
display kernel
parameters

edit and update file then reboot:


/etc/system

build kernel

interprocess
communication

ipcs -a

sysctl -a
cat /etc/sysctl.conf

sysctl -a
cat /etc/sysctl.conf

cat /proc/sys/kernel/sem
cat /proc/sys/kernel/shmmax
etc...................................

cat /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

Note: only a few kernel parameters can be changed

display kernel pa

chdev -l sys0 -a <parameter>=<value>

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
ipcs -a

lsattr -EHl sys0

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

ipcs -a

ipcs -a

Note: most parameters are dynamically changed in AIX , for example


memory segments are dynamically adjusted
build kernel

ipcs -a

interprocess
communicat

Services
Solaris

Red Hat
service --status-all

display services

start services
stop services
reload service
restart service

svcs -a
svcs -l <service>
svcs -vx
inetadm -l

Ubuntu/Debian
There is no services or chkconfig
command use the old fashioned way
/etc/init.d/<service>

HP

AIX

lssrc -a
There is no services or chkconfig
command
use the old fashioned way /sbin/init.d
/<service>

display services

svcadm enable nfs

service nfs start

startsrc -s <subsystem>
startsrc -g <group>

start services

svcadm disable nfs

service nfs stop

stopsrc -s <subsystem>
stopsrc -g <group>

stop services

svcadm refresh nfs


svcadm clear nfs (changes state)

service nfs reload

refresh -s <subsystem>

svcadm restart nfs

service nfs restart

stopsrc -s <subsystem>
startsrc -s <subsystem>

reload service
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

# change or add
Service notifications svccfg

5 of 8

04/28/2014 04:32 PM

Unix Commands

http://www.datadisk.co.uk/html_docs/misc/unix_...

# verify or confirm
svcprop

service logging, etc

change service
startup

n/a

/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

chkconfig --levels 2345


nfs on

service logging, etc

n/a

change service
startup

n/a
# Create your stop/start
# script in /etc/init.d

Add a new service

chkconfig --add <script>

Patching / Software
Solaris

Red Hat

Ubuntu/Debian

HP

showrev -p
patchadd -p

display installed patches

patchadd
patchadd -M <dir> (multiple patches)

display installed patches


instfix -k

swcopy (install patch into depot)


swinstall (install patch from depot)

Note: -p = # of path stripping

patchrm

patch -R -p1 <patch>

pkginfo (all packages)


pkginfo -l (single package)
pkgchk -l -p <file> (file belongs)

rpm -qa (all packages)


rpm -q (single package)
rpm -qf (file belongs)
rpm -qi <package> (very detailed)

adding patch

Note: the swagentd daemon must be running


swremove

# NEW IPS
pkg list (all packages)
pkg info (single package)
pkg search (find packages and files)

display installed packages

instfix -ia

patch -p1 <patch>


zcat patch46.gz | patch -p1

adding patch

removing patch

AIX

swlist -l bundle
swlist -l product
swlist -l patch

installp -r

swlist -l bundle <bundle>


swlist -l product <product>

dpkg -l
dpkg -S <search string> (search)
dpkg -S <filename> (file belongs)
dpkg -s <package> (status)
dpkg -p <package> (detailed)

## check a package
swlist -s <full_path/software>

removing patch

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)

display installed packages

oslevel -g (install packkages above os level)


whereis <filename>
which_fileset <filename>
rpm -Uhv (updates/installs if not already)
rpm -ihv (install)

pkgadd

dpkg -i <package>

swinstall
swinstall -s <full_path/software>

# NEW IPS
pkg install
pkg update

adding package

installp -a
installp -c (cleanup after failed install)
adding package

rpm -i
geninstall (generic installer: installp, RPM, etc)
rpm -e <package>

dpkg -r <package> (do not remove config files)


dpkg -P <package> (remove config files)

pkgrm

swremove
installp -u (commited packages)
installp -r (applied packages)

# NEW IPS
pkg uninstall <package>

removing packages

rpm -e <package>

removing packages

geninstall -u <package>
rpm -V <package>

n/a

swverity <fileset> (see /var/adm/sw/swagent.log)

pkginfo -l
pkginfo -p
verify package

lppchk -v
rpm -V <package>
verify package

# NEW IPS
pkg publisher
pkg verify <package>
pkgchk -l <package> | grep -i pathname

rpm -ql <package>

dpkg -L <package> (list files)

swlist -l file <product>


lslpp -f <fileset>

List files in package

List files in package

# NEW IPS
pkg contents <package>

rpm -ql <package>

# NEW IPS
pkg history
pkg purge-history
pkg freeze
pkg unfreeze
pkg fix
pkg refresh
pkg publisher

Other package commands

/var/sadm

/var/lib/rpm

/var/lib/dpkg/info

/var/adm/sw
/usr/lpp

Package directory

Package directory
/var/lib/rpm

List libraries required for binary


program

ldd <file>

ldd <file>

ldd <file>

chatr <file>

ldd <file>

List libraries required for binar


program

Accounts
Solaris
cat /etc/passwd
display users

Red Hat
cat /etc/passwd
system-config-users (GUI)

Ubuntu/Debian
cat /etc/passwd

HP
cat /etc/passwd
logins -x

logins -x [-p]

AIX
cat /etc/passwd
display users
lsuser -f ALL (detailed)

useradd
create a user

# user defaults
/usr/sadm/defadduser

remove a user

userdel

useradd
system-config-users (GUI)

useradd

useradd
sam

mkuser
useradd

create a user

userdel
system-config-users (GUI)

userdel

userdel
sam

rmuser
userdel

remove a user

usermod
sam

chuser -a
usermod
passwd -f
passwd -s
chfn <username>
chfn <username><shell>

modify a user

usermod
system-config-users (GUI)

modify a user

usermod

usermod

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

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

useful user
commands

# License information
lslicense
chlicense

useful user commands

# Maximum number of processes for a user


lsattr -D -l sys0 -a maxuproc
chdev -l sys0 -a maxuproc=<number>

6 of 8

useful group
commands

groups
setpgrp
newgrp

groups

Password Policy

/etc/security/policy.conf
/etc/default/passwd

/etc/login.defs

groups

groups
setprivgrp

groups
setgroups
lsgroup ALL

useful group commands

04/28/2014 04:32 PM

Unix Commands

http://www.datadisk.co.uk/html_docs/misc/unix_...

passwd

Password Aging

chage -l <user>
chage <options> <user>

NFS
Solaris
NFS Daemons

NFS files

List nfs clients that have a remote mount


display nfs shares

Red Hat

HP

AIX

server: rpc.mountd,nfsd
client: rpc.statd, lockd

/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

/etc/rmtab

/var/lib/nfs/rmtab

/var/lib/nfs/rmtab

/etc/rmtab

/etc/xtab

dfshares
showmount -e localhost

showmount -e localhost

showmount -e localhost

showmount -e localhost

exportfs
showmount -e localhost

/etc/dfs/dfstab (edit and add share)


share <path>

redhat-config-nfs (GUI)

/etc/exports (edit and add share, see below example)


exportfs -rav (export the shares)

## dfstab example
share -F nfs -d "jumpstart" /export/jumpstart

create nfs share

Ubuntu/Debian

server: mountd, nfsd


client: statd, lockd

/etc/exports (edit and add share)


/sbin/service nfs reload

server: rpc.mountd, nfsd


client: rpc.statd, rpc.lockd

/etc/rc.config.d/nfsconf (edit)
/etc/exports (edit and add share)
exportfs -a

/etc/init.d/portmap restart
/etc/init.d/nfs-kernel-server restart

## /etc/exports example
/export *(rw,fsid=0,insecure,no_root_squash,sync)
unshare <path>
/etc/dfs/dfstab (edit and remove share)

server: rpc.mountd, nfsd


client: rpc.statd, lockd

server: rpc.mountd,nfsd
client: rpc.statd, lockd

NFS files
List nfs c
remote mount
displa

mknfsexp -d <directory>
mknfsmnt
shareall

crea

## /etc/exports example
/export *(rw,fsid=0,insecure,no_root_squash,sync)

/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)

/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
chnfs

uncreate nfs share

/etc/init.d/nfs.server start
/etc/init.d/nfs.client start
start/change nfs daemons

exportfs -u <filesystem>
unshareall

un

sta

startsrc -s nfsd
startsrc -s rpc.mountd

svcadm enable nfs/server


svcadm disable nfs/server
/etc/init.d/nfs.server stop
/etc/init.d/nfs.client stop

stop nfs daemons

NFS Da

/sbin/service nfs stop

ps -ef|grep < nfs daemons>

/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
stop nf

stopsrc -s nfsd
stopsrc -s rpc.mountd

/sbin/service nfs status

/etc/init.d/nfs-kernel-server status

ps -ef | grep <nfs daemons>

lssrc -a |grep -i nfs

nfs reload

shareall

/sbin/service nfs reload

exportfs -rav (export the shares)

exportfs -a

exportfs -av

nfs

nfs performanace

nfsstat

nfsstat

nfsstat

nfsstat

nfsstat

nfs

n/a

cat /var/lib/nfs/etab

cat /var/lib/nfs/etab

n/a

nfso -a
nfso -o <option>=<value>

n/a

n/a

n/a

n/a

nfs status

nfs Options

nfs status

nfs Options

exportfs (display options)


## Make sure you use NFS version 3
solaris/redhat mount problems (nfs v3 to
mount -F nfs -o vers=3 <mount>
v4)
<mountpoint>

so
prob

NTP
Solaris

Red Hat

Ubuntu/Debian

HP

ntpd
Time daemons

xntpd

ntpd

# Solaris 8
/etc/ntp.conf
/etc/ntp.server
/etc/ntp.client

/etc/ntp.conf (edit with ntp servers)


dateconfig (GUI)

/etc/default/ntp
/etc/ntp.conf

chkconfig --list ntpd


chkconfig --level 2345 ntpd on
/sbin/service ntpd start

/etc/init.d/ntp [start|stop|restart]

/etc/sysconfig/ntpd

/etc/default/ntp

/etc/rc2.d/xntpd [start|stop]

ntp setup

AIX

xntpd

xntpd

/etc/rc.config.d/netdaemons (set XNTPD to 1)


/etc/ntp.conf

/etc/ntp.conf

Time daemons

startsrc -s xntpd
stopsrc -s xntpd
lslpp -L all|grep xntpd

ntp setup

# Solaris 10
/etc/inet/ntp.server
/etc/inet/ntp.client
svcadm enable ntpd
/lib/svc/method/xntp

/etc/rc.config.d/netdaemons
startsrc -s xntpd -a "-x"

ntp daemon options

ntp daemon options


/etc/rc.tcpip
ntpq -p
ntptrace

NTP Trace commands

ntpq -p
ntptrace

ntpq -p
ntptrace

ntpq -p
ntpdate (set the date)

ntpq -p
ntptrace
ntpdate

NTP Trace commands

Log Files
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

mail

/var/log/cron

/var/log/cron.log

/var/adm/cron/log

/var/adm/cron/log

cron

mail
cron

/var/cron/log

/var/adm/ras
boot

/var/adm/messages
dmesg

/var/log/boot
dmesg

/var/log/boot
dmesg

/var/adm/syslog/syslog.log
dmesg

alog -o -t boot
alog -o -t console
alog -L (list all the logs available)

boot

/usr/lib/errdemon -l (display attributes)


/usr/lib/errdemon (start error logging)
/usr/lib/errstop (stop error logging)

Error
logging

logger

logger

logger

# use with above errorlog file


errpt (summary errorlog report)
errpt -a (detailed errorlog report)
errpt -j <identifier> (single errorlog report)

logger

Error logging

errclear (clears errorlog)


errclear -d <class><days> (clears class errors)
errlogger "message upto 230 chars"

Security
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

# No reboot required
/etc/securetty

# No reboot required
/etc/securetty

# Solaris 10 (no reboot)


/etc/default/login
console login (allow/deny)

# No reboot required
/etc/security/user
# No reboot required
/etc/securetty

# Solaris 11 (no reboot)


/etc/default/login
/etc/user_attr (see below)

chsec -f /etc/security/user -s root


console login (allow/deny)

Note: you may need to create this file


if it does not exist

rolemod -K type=normal root

Misc
Solaris
eeprom
startup

7 of 8

setenv boot-device

Red Hat
grub (GUI)
lilo (text based)

Ubuntu/Debian
grub (GUI)

HP
setboot -p <primary path>
setboot -a <alternate path>

AIX
bootlist -m normal hdisk0 hdisk1
startup

# autoboot sequnce
setboot -b [on|off]

04/28/2014 04:32 PM

Unix Commands

http://www.datadisk.co.uk/html_docs/misc/unix_...

shutdown -i5 -g0 -y (power down)


shutdown -i6 -g0 -y (reboot)
shutdown -i0 -g0 -y (OK prompt)
shutdown

Change run level

init status
0
1
2
3
4
5
6

Startup options

shutdown -h (halt)
shutdown -r (reboot)
shutdown -f (fast reboot no fsck)
shutdown -F (force fsck)

shutdown -h (halt)
shutdown -r (reboot)
shutdown -P (power off)

reboot -- -r (reboot/reconfigure)

touch /forcefsck

touch /reconfigure

# edit /etc/default/rcS change below so


# you dont have to hang around
FSCKFIX=yes
halt
init
poweroff
reboot
shutdown
telinit

halt
init
poweroff
reboot
shutdown
telinit
uadmin

halt
init
poweroff
reboot
shutdown
telinit

0 - shutdown
1 - single user
2 - n/a
3 - Multi-user
4 - n/a
5 - power off
6 - reboot

0 - halt
1 - single user
2 - multiuser (no networking)
3 - multiuser (networking)
4 - unused
5 - GUI
6 - reboot

# change default
vi /etc/inittab

# change default
vi /etc/inittab

boot <option>

single - use grub to edit kernel line


emergency - use grub to edit kernel line
linux rescue - use at the boot prompt

single - use grub to edit kernel line


emergency - use grub to edit kernel line
linux rescue - use at the boot prompt

single: runlevel1, local fs mounted, no network


emergency: root fs read-only, no init files run
rescue: use cd-rom/network, root mounted as
/mnt/sysimage

single: runlevel1, local fs mounted, no network


emergency: root fs read-only, no init files run
rescue: use cd-rom/network, root mounted as
/mnt/sysimage

# Options
-s single user
-a interactive
-x no device drivers (used in
clustering)
-r reconfigure devices
-m milestone

0 - halt
1 - single user
2 - multiuser (default)
3 - same as 2
4 - same as 2
5 - same as 2
6 - reboot

# change default - change all the telinit


vi /etc/event.d/rc-default

shutdown -h now (halt)


shutdown -r now(reboot)

shutdown

init
reboot
shutdown

0 - halt
1 - single users
2 - multiuser (networking)
3 - multiuser (networking, NFS, and CDE GUI) (default)
4 - multiuser (netwrking, NFS, and VUE GUI)
5 - n/a
6 - n/a

# change default - change the initdefault line


vi /etc/inittab

/etc/init.d

/etc/init.d

/etc/rc0.d - /etc/rc6.d

/etc/rc0.d - /etc/rc6.d

/etc/rc0.d - /etc/rc6.d

init
shutdown
reboot
telinit
halt

Change run level

init status
0
1
2
3
4
5
6

0 - reserved
1 - reserved
2 - multiuser mode with NFS
3 - user defined
4 - user defined
5 - user defined
6 - user defined
7-9 - user defined
# change default - change the initdefault line
vi /etc/inittab

interact with IPL? Y

Based on 9114-275 workstation

# single user
ISL> hpux -is

1. switch off the machine


2. power on and enter the SMS menu

# Logical volume maintanence mode


ISL> hpux -lm
# No quroum check
ISL> hpux -lq

/etc/init.d

shutdown -F (fast shutdown)


shutdown -Fr (fast shutdown and reboot)

/sbin/init.d
/etc/rc.config.d (startup config files)

Startup options
Note: to enter the SMS menu press numeric 1
after the word keyboard but before the word
speaker

/etc/rc.d
/etc/rc.d/init.d

/sbin/rc0.d - /sbin/rc6.d
/etc/rc.d/rc2.d - rc9.d

startup scripts

startup scripts

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


also uses the System Resource Controller
F10 or F12

boot prompt
commands

F10 or F12

interact with IPL? Y


Based on a 9114-275 workstation

boot
printenv
setenv
banner
devalias
show-devs
show-pci-devs-all
probe-scsi-all
probe-fcal-all
probe-pci
watch-net-all
reset-all

Phases:
Boot PROM: displays system
information, run POST, load
bootblk, locate ufsboot
Boot Programs: bootblk loads
and executes the ufsboot
Kernel Initialization: ufsboot
loads and executes the core
kernel, initializes core kernel
data structures, loads other
kernel modules based on the
/etc/system file, starts /sbin/init
program
init: starts other processes
based on the /etc/inittab file

Boot process

1. switch off the machine


2. power on and enter the SMS menu
Note: to enter the SMS menu press numeric 1
after the word keyboard but before the word
speaker

Boot sequence
1. BIOS
2. POST
3. Master Boot Record (MBR) - point to the
bootloader GRUB or LILO
4. GRUB (stage 1) - point to GRUB stage 1_5
5. GRUB (stage 1_5) - deals with specific
filesystem types look at /boot/grub/*1_5 files
6. GRUB (stage 2) reads /etc/grub.conf and
displays the grub menu, it specifies the kernel
and the initrd files
7. KERNEL - control given to the kernel
8. INIT - reads /etc/inittab and runs /etc/rc.d
/rc.sysinit script

Boot sequence

Phases:

1. BIOS
2. POST
3. Master Boot Record (MBR) - point to the
bootloader GRUB or LILO
4. GRUB (stage 1) - point to GRUB stage 1_5
5. GRUB (stage 1_5) - deals with specific
filesystem types look at /boot/grub/*1_5 files
6. GRUB (stage 2) reads /boot/grub/menu.lst
and displays the grub menu, it specifies the
kernel and the initrd files
7. KERNEL - control given to the kernel
8. INIT - runs the /etc/event.d/rc-default script

boot prompt
commands

Phases:

1. PDC - processor-dependent code; executes and


performs self-tests
2. ISL - initial system loader; loads the secondary
system loader hpux
3. HPUX - is the secondary system loader and loads
the kernel /stand/vmunix, then hands over to the
kernel
4. KERNEL - swapper processes are started by the
kernel then starts the init process
5. INIT - reads /etc/inittab

Read 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
script
Base Device Configuration: start
Boot process
configuration manager to configue base
devices
System 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 script

bootadm list-archive
bootadm update-archive
bootadm list-menu
bootadm set-menu <option>
Boot Environments
(BE)

beadm create
beadm rename
beadm activate
beadm list
beadm destroy

determine the run


level

who -r

runlevel
who -r

runlevel
who -r

who -r

who -r

obtain default run


level

cat /etc/inittab

cat /etc/inittab

/etc/event.d/rc-default

/etc/inittab

/etc/inittab

list locale

locale -a

locale -a

locale -a

locale -a

locale -a

n/a

startx (shorthand of below)


initx (lots of parms)

n/a

n/a

set_parms [initial|hostname|ip_address|timezone]

install_assist

start xwindows

sys-unconfig
initialize system

determine the run level


obtain default run level
list locale
start xwindows

initialize system
Note: set_parms is in /sbin

Timezone

8 of 8

/etc/TIMEZONE
/etc/default/init

/etc/sysconfig/clock
/usr/share/zoneinfo/zone.tab

/etc/timezone
/usr/share/zoneinfo/zone.tab

/etc/TIMEZONE

/etc/environment
/etc/profile

Timezone

04/28/2014 04:32 PM

You might also like