Common Unix Commands
Swap Information regarding the swap area
Sysinfo Display system information i.e cpu, memory, etc
Services Display, start and stop services
NFS Information on NFS i.e starting, stopping, etc
Disk Displaying disk information i.e type, serial number, etc
Kernel Modules Displaying and modifing kernel parameters
Networking Display and configuring network parameters
Patching / Packages Installing and removing patches and software packages
Accounts Setting up and removing user accounts
NTP Network Time Protocol
Log Files Location to common log files
Security Security information
Misc Other stuff i.e shutdown, timezone, run level, etc
swap
Solaris Red Hat HP
swap -l cat /proc/swaps (detailed) swapinfo (displayed in KB)
display swap swap -s swapon -s swapinfo -m (display in Mb)
swapinfo -tm (total / Mb)
Create logical volume or filesystem
mkfile 5m device:
/var/swapfile create partition with fdisk (type 82) swapon <device> | -f <logical device>
swap -a /var/swapfile file: swapon -p 3 <device> | -f <logical
dd if=/dev/zero of=/var/swapfile bs=1024 device>
adding swap update /etc/vfstab count=65536
update /etc/fstab
mkswap <device>|<file>
swapon <device>|<file> Note: -p = priority swap number
update /etc/fstab
update /etc/vfstab swapoff <device>|<file> remove entry from /etc/fstab
removing swap swap -d reboot
Remove device or file as normal
sysinfo
Solaris Red Hat HP
/usr/platform/`uname -r`/sbin/prtdiag
Server type -v model
uname -a
prtdiag -v lspci
Hardware Info prtpicl -v [-c <class>] lsusb
prtconf -D
/usr/platform/`uname -r`/sbin/prtdiag cat /proc/meminfo (detailed) dmesg | grep -i physical
Memory -v free -om /usr/sam/lbin/getmem
prtconf | grep -i mem /opt/ignite/bin/print_manifest
/usr/platform/`uname -r`/sbin/prtdiag cat /proc/cpuinfo (detailed) /opt/ignite/bin/print_manifest
CPU (type, number, etc)
-v sam -> performance monitors -> system properties
format fdisk -l ioscan -funC disk
prtvtoc <device> sfdisk -l (advanced server)
Disk Drives parted <device> print
format -e (to convert EFI (zfs) to partprobe <device>
SMI)
format hdparm -i /dev/hda diskinfo -v /dev/rdsk/c0t4d0 (detailed but no serial
iostat -En hdparm -I /dev/hda (detailed) number)
Disk serial Number, type, etc
luxadm inq <disk> (A5x00 disk /opt/ignite/bin/print_manifest (no serial number)
arrays) cat /proc/ide/ide0/hda/model
prtvtoc <device> fdisk -l lifls -Clv <device>
sfdisk -l (advanced server)
Disk disk partitions
cat /proc/partitions (very high level)
List Raw Partitions n/a raw -qa n/a
tunefs tune2fs tunefs
Tune Filesystems
fstyp -v <device> tune2fs -l /dev/sda1
isainfo -kv (solaris 9+) uname -a
isalist (sparc v9 will be listed first) uname -m getconf KERNEL_BITS ( version 11)
getconf -a |grep -i 'long_bit'
Kernel 32 or 64 HPUX < version 11 all 32 bit
Note: determine if system supports 64 bit
getconf HW_CPU_SUPP_BITS
At the OK prompt type banner boot into the BIOS (normally F2 or workstations:
F12) reboot
enter PDC
Display Firmware type: IN (information menu)
type: FV (Firmware Version)
servers:
truss -p <pid> strace -p <pid> download and install tusc
Trace system calls
tusc -p <pid>
n/a /proc/interrupts n/a
Display IRQ, IO ports and
/proc/ioports
DMA
/proc/dma
Services
Solaris 10 Red Hat HP
services --status-all n/a
display services svcs -a
inetadm -l
start services svcadm enable nfs service nfs start n/a
stop services svcadm disable nfs service nfs stop n/a
reload service svcadm refresh nfs service nfs reload n/a
restart service svcadm restart nfs service nfs restart n/a
service status svcs nfs service nfs staus n/a
service dependencies svcs -d network n/a n/a
service dependants svcs -D network n/a n/a
/var/svc/log n/a n/a
service logging, etc /var/svc/manifest
/lib/svc/method
NFS
Solaris Red Hat HP
NFS Daemons server: mountd, nfsd server: rpc.mountd,nfsd server: rpc.mountd, nfsd
client: statd, lockd client: rpc.statd, lockd client: rpc.statd, lockd
/etc/dfs/dfstab /etc/exports
/etc/dfs/sharetab
dfshares showmount -e localhost showmount -e localhost
display nfs shares
showmount -e localhost cat /etc/xtab (currently exported)
/etc/dfs/dfstab (edit and add share) redhat-config-nfs (GUI)
share <path> /etc/rc.config.d/nfsconf (edit)
create nfs share
/etc/exports (edit and add share) /etc/exports (edit and add share)
/sbin/service nfs reload exportfs -a
unshare <path> /etc/exports (edit and remove share) /etc/rc.config.d/nfsconf (edit)
/etc/dfs/dfstab (edit and remove share) /sbin/service nfs reload exportfs -au (unshare all)
uncreate nfs share
exportfs -u /home/vallep
/etc/exports (edit and remove share)
/etc/init.d/nfs.server start /sbin/service nfs start /sbin/init.d/nfs.core start
/etc/init.d/nfs.client start /sbin/init.d/nfs.server start
nfs start /sbin/init.d/nfs.client start
svcadm enable nfs/server
svcadm disable nfs/server
/etc/init.d/nfs.server stop /sbin/service nfs stop /sbin/init.d/nfs.client stop
nfs stop /etc/init.d/nfs.client stop /sbin/init.d/nfs.server stop
/sbin/init.d/nfs.core stop
nfs status ps -ef|grep < nfs daemons> /sbin/service nfs status ps -ef | grep <nfs daemons>
nfs reload shareall /sbin/service nfs reload exportfs -a
nfs performanace nfsstat nfsstat nfsstat
List nfs clients that have remote mount cat /etc/rmtab cat /etc/rmtab
Disk
Solaris Red Hat HP
eeprom cat /etc/grub.conf setboot
cat /etc/lilo.conf
Display the boot device
grub = grand unified boot loader
lilo = linux loader
setenv boot-device <device> | <alias> /etc/grub.conf setboot -p <primary path>
eeprom boot-device <device> | <alias> /etc/lilo.conf setboot -a <alternate path>
setting the boot device
installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk grub-install <raw-device> mkboot
Creating boot device (MBR)
<raw-device> lilo -v
fdformat -v -U floppy --probe (use device obtained n/a
volcheck -v below )
format floppy drive newfs -v /vol/disk/aliases/floppy0 floppy --createrc > /etc/fd0
floppy --format /dev/fd0
mkfs /dev/fd0
volrmmount -l floppy0 mount /dev/fd0 /mnt/floppy n/a
mount/unmount floppy
eject floppy umount /mnt/floppy
mount -F hsfs -o ro <device path> /cdrom/cdrom0 mount -rF cdfs /dev/dsk/c1t6d0 /cdrom
umount /cdrom/cdrom0 mount -rt iso9660 /dev/cdrom
mount/unmount CDROM /mnt/cdrom start: /usr/sbin/pps_mountd
/etc/init.d/volmgr start umount /mnt/cdrom pps_mount
eject cdrom eject cdrom
n/a mkbootdisk `uname -r` (boot recovery tape (preview)
create boot disk or recovery diskette) make_tape_recovery -v -l -x
tape inc_entire=vg00
/opt/ignite/bin/make_recovery -ACv
ok> boot cdrom -s linux single (at the boot prompt) enter PDC
> search
boot cdrom/diskette (single
>boot p1 (cdrom)
user)
interact with IPL? Y
ISL> hpux -is
ok> boot -as f10 or f12 >boot pri
boot into maintenace mode interact with IPL? Y
ISL> hpux -lm
Kernel Modules
Solaris Red Hat HP
modinfo cat /proc/modules (more detailed) kmadmin -k
lsmod
display loaded modules
Location:
/lib/modules/`uname -r`/kernel/drivers
modload -p drv/st modprobe <module> kmadmin -L <module name>
load modules
insmod
modunload -i drv/st modprobe -r <module>
unload modules rmmod kmadmin -U <module name>
kmadmin -u <module id>
edit /etc/sysctl.conf (edit and update then reboot) kcweb (11i)
/etc/system sysctl -p <filename> kctune (11i only)
reboot rebuild kernel (< 11i see below)
sysctl -w param=value
No reboot (dynamically):
set kernel parameters
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.............................................
cat /etc/system sysctl -a kctune (11i only)
sysdef -i cat /etc/sysctl.conf sysdef
ipcs -a kmtune
display kernel cat /proc/sys/kernel/sem kmsystem
parameters cat /proc/sys/kernel/shmmax /usr/sam/lbin/getkinfo -f /stand/vmunix -o /tmp/kernel.data
etc...................................
ipcs -a
cd /usr/src/linux-2.4
edit and update file then edit Makefile (change EXTRAVERSION) cd /stand/build
reboot: make mrproper /usr/lbin/sysadm/system_prep -s system
/etc/system backup .config edit system file
make xconfig /usr/sbin/mk_kernel -s ./system
make dep mv /stand/system /stand/system.old
build kernel
make bzImage mv /stand/vmunix /stand/vmunix.old
make modules mv /stand/build/system /stand
move new kernel mv /stand/build/vmunix_test /stand/vmunix
make modules_install reboot
change lilo/grub config file
reboot
Networking
Solaris Red Hat HP
Basic network information /etc/hostname.hme0 /etc/sysconfig/network /etc/rc.config.d/netconf
(hostname, ip address)
/etc/defaultrouter edit /etc/sysconfig/network /etc/rc.config.d/netconf
default router
add: GATEWAY=<IP address>
Starting and stopping a network ifconfig qfe0 up /sbin/ifup eth0 ifconfig lan0 up
interface ifconfig qfe0 down /sbin/ifdown eth0 ifconfig lan0 down
ndd -get <device> <parm> lanadmin -x
ndd -get dev/ip \? (list all params) mii-tool -v
ethtool eth1 ndd -get <device> <parm>
NIC speeds or Parameters
kstat hme:0 ethtool -t eth0 online ndd -get /dev/ip \? (list all params)
sysctl -a | grep net*
ndd -set <device> <parm> <value> mii-tool -F 100baseTx-FD eth0 ndd -set <device> <parm> <value>
(dynamically) ethtool -s eth1 speed 100 duplex full lanadmin -X <option> lan0
Setting NIC speed
/etc/system (edit and update then reboot -
permanent)
if_mpadm -d (detach) ifenslave -d bond0 eth1 (detach)
if_mpadm -r (reattach) ifenslave bond0 eth1 (reattach)
Test IPMP, Bonding
tail /var/adm/messages cat /proc/net/bonding/bond0
display routing table netstat -n netstat -rn netstat -rn
prtdiag -v ifconfig ioscan -funC lan (list hardware)
displaying network interfaces ifconfig -a system-config-network (GUI) lanscan -v (list configured)
ifconfig lan0 (individual)
ifconfig -a (as user root) ifconfig lanscan
display MAC address
system-config-network (GUI)
setup DNS /etc/resolv.conf /etc/resolv.conf /etc/resolv.conf
/etc/nsswitch.conf /etc/nsswitch.conf
Name service switch file (DNS client) /etc/nsswitch.conf /etc/host.conf /etc/resolv.conf
/etc/resolv.conf /etc/resolv.conf
snoop -d <interface> tcpdump -i <interface> nettl -start
nettl -status all
ethereal (needs to be installed) nettl -tn pduin pduout -e ns_ls_driver -file
Displaying network packets /var/adm/LAN
nettl -stop
use netfmt to display the trace file
Domain Name /etc/defaultdomain /etc/sysconfig/network (GATEWAY
option)
Obtain IP Address routing route -n get <hostname> ip route get <IP address>
Patching / Software
Solaris Red Hat HP
showrev -p swlist -l patch (HP 11)
display installed patches
patchadd -p swlist -l product PH* (HP 10.x)
patchadd patch -p1 <patch>
patchadd -M <dir> (multiple patches) swcopy (install patch into depot)
adding patch zcat patch46.gz | patch -p1 swinstall (install patch from depot)
Note: -p = # of path stripping Note: the swagentd daemon must be running
removing patch patchrm patch -R -p1 <patch> swremove
pkginfo (all packages) rpm -qa (all packages) swlist -l bundle <bundle>
pkginfo -l (single package) rpm -q (single package) swlist -l product <product>
display installed packages
pkgchk -l -p <file> (file belongs) rpm -qf (file belongs)
rpm -qi <package> (very detailed)
pkgadd rpm -Uhv (updates/installs if not already) swinstall
adding package
rpm -ihv (install)
removing packages pkgrm rpm -e swremove
rpm -V package swverity <fileset> (see /var/adm/sw/swagent.log)
verify package pkginfo -l
pkginfo -p
List files in package pkgchk -l <package> | grep -i pathname rpm -ql <package> swlist -l file <product>
Accounts
Solaris Red Hat HP
cat /etc/passwd cat /etc/passwd cat /etc/passwd
display users
logins system-config-users (GUI) logins
useradd useradd
adding a user useradd
system-config-users (GUI) sam
userdel userdel
removing a user userdel
system-config-users (GUI) sam
modifying a user usermod usermod usermod
system-config-users (GUI) sam
/etc/passwd /etc/passwd
password files /etc/passwd
/etc/shadow /tcb/files/auth/r/root (trusted system)
NTP
Solaris Red Hat HP
netdaemons
Time daemons
xntpd ntpd
Edit: chkconfig --list ntpd /etc/rc.config.d/netdaemons (set XNTPD to 1)
# Solaris 8 chkconfig --level 2345 ntpd on /etc/ntp.conf
/etc/ntp.conf /etc/ntp.conf (edit with ntp servers)
/etc/ntp.server /sbin/service ntpd start
ntp setup /etc/ntp.client
dateconfig (GUI)
# Solaris 10
/etc/inet/ntp.server
/etc/inet/ntp.client
ntpq -p ntpq -p
NTP Trace commands
ntptrace ntptrace
Log Files
Solaris Red Hat HP
messages /var/adm/messages /var/log/messages n/a
syslog /var/log/syslog n/a /var/adm/syslog/syslog.log
mail /var/log/mail /var/adm/syslog/mail.log
cron /var/cron/log /var/log/cron /var/adm/cron/log
boot /var/adm/messages /var/log/boot /var/adm/syslog/syslog.log
Security
Solaris Red Hat HP
Checking the passwd file pwck pwck pwck
checking the group file grpck grpck grpck
console login (allow/deny) /etc/default/login (Edit file no reboot /etc/securetty (no reboot) /etc/securetty (no reboot)
required)
Misc
Solaris Red Hat HP
eeprom grub (GUI) setboot -p
startup lilo (text based)
setenv boot-device
shutdown -i5 -g0 -y (power down) shutdown -h (halt) shutdown -h -y (halt)
shutdown -i6 -g0 -y (reboot) shutdown -r (reboot) shutdown -r -y (reboot)
shutdown shutdown -i0 -g0 -y (OK prompt) shutdown -f (fast reboot no fsck)
shutdown -F (force fsck)
reboot -- -r (reboot/reconfigure)
init status shutdown halt
0 single user single user halt
1 n/a multiuser (no networking) single users
2 Multi-user multiuser (networking) multiuser (no networking)
3 n/a unused multiuser (networking and GUI)
4 power off GUI multiuser (netwrking and old GUI)
5 reboot reboot n/a
6 n/a
-s single user linux single
-a interactive linux emergency
-x no device drivers (used in clustering) linux rescue
-r reconfigure devices
Startup options
-m milestone 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
/etc/init.d /etc/init.d /etc/rc.config.d
startup scripts
/etc/rc0.d - /etc/rc6.d /etc/rc0.d - /etc/rc6.d /sbin/rc0.d - /sbin/rc6.d
determine the run level who -r runlevel who -r
obtain default run level cat /etc/inittab cat /etc/inittab /etc/inittab
n/a startx (shorthand of below) n/a
start xwindows
initx (lots of parms)
n/a touch /forcefsck n/a
force a fsck
shutdown -rF now
page size (memory) /usr/bin/pagesize /usr/bin/getconf -a| egrep -i 'pagesize|page_size' 4Kb
initialize system sys-unconfig netconf set_parms initi
/etc/TIMEZONE /etc/sysconfig/clock /etc/TIMEZONE
Timezone
/etc/default/init
drvconfig /dev/MAKEDEV <device> insf -C tape (Class)
devlinks
update /dev directory disks|tapes|ports insf -H 0.1.0 -e (recreate deleted link)
devfsadm ( solaris 8, 9, 10)
remove device rem_drv rmsf
list device drivers prtconf -D cat /proc/devices lsdev
change the follwing four files:
/etc/nodename
change the hostname /etc/hostname.<interface>
/etc/inet/hosts
/etc/inet/ipnodes
floppy: floppy: floppy:
/dev/fd0 n/a
disk:
/dev/dsk/c0t0d0s0 disk: disk:
/dev/hda or /dev/sda /dev/dsk/c0t6d0
Device paths tape: /dev/hdb or /dev/sdb
/dev/rmt/0ucb tape:
tape: /dev/dsk/rmt/0
cdrom:
/dev/dsk/c0t6d0s0 cdrom: cdrom:
/dev/hda (depends on number of IDE disks) /dev/dsk/c1t6d0
dumpadm -d <device> diskdump edit /stand/system
netdump
crash (used to analyse crash dumps) kdump (part of kexec rpm) add either:
Crash Dump
adb (used to analyse crash dumps) dump 2/0/1.5.0
crash (used to analyse crash dumps) dump lvol
dump none
Boot (jumpstart) servers: Boot (jumpstart) servers: Boot (jumpstart) servers:
rpcinfo -b bootparam 1 rpcinfo -b bootparam 1 rpcinfo -b bootparam 1
NFS servers: NFS servers: NFS servers:
Find Services on network rpcinfo -b mountd 1 rpcinfo -b mountd 1 rpcinfo -b mountd 1
NIS servers/slaves: NIS servers/slaves: NIS servers/slaves:
rpcinfo -b ypserv 1 rpcinfo -b ypserv 1 rpcinfo -b ypserv 1