HP Unix Cheat Sheet
HP Unix Cheat Sheet
This is a document that can be used for revision purposes for HP-UX.
Kernel
Kernel parms and Hardware. /usr/sbin/sysdef or ioscan –fn
Major numbers (devices) lsdev
Unix device messages dmesg
Configuration files /etc/rc.config.d
Unix Kernel /stand/vmunix
All crash files. /var/adm/crash
kmadmin
display loaded modules kmadmin -s
load modules kmadmin -L
unload modules kmadmin -U
kctune (11i)
set kernel parameters rebuild kernel
kctune (11i)
sysdef
display kernel parameters kmtune
kmsystem
usr/sam/lbin/getkinfo -f /stand/vmunix -o /tmp/kernel.data
cd /stand/build
/usr/lbin/sysadm/system_prep -s system
edit system file
/usr/sbin/mk_kernel -s ./system
re/build kernel mv /stand/system /stand/system.old
mv /stand/vmunix /stand/vmunix.old
mv /stand/build/system /stand
mv /stand/build/vmunix_test /stand/vmunix
shutdown -r 0
System Information
dmesg |grep -I physical
amount of memory /usr/sam/lbin/getmem
/opt/ignite/bin/print_manifest
/opt/ignite/bin/print_manifest
sam > performance monitors > system properties (detailed)
cpu (type, number, etc) model
uname -m
disk drives pvdisplay -v
diskinfo -v /dev/rdsk/c0t4d0 (detailed but no serial number)
disk info serial numbers /opt/ignite/bin/print_manifest
ioscan -fn -C disk
getconf KERNEL_BITS (11.0)
(HPUX < 11.00 all 32 bit)
Kernel 32 or 64
Note: determine if system supports 32/64 bits
getconf HW_CPU_SUPP_BITS
Display firmware < 10.20:
1. At the system prompt, enter "sysdiag"
2. At the DUI prompt, enter "sysmap"
3. At the ENTER MAP prompt, enter "cpumap"
4. Note the PDC Firmware value
5. At the ENTER MAP prompt, enter "exit"
6. At the DUI prompt, enter "exit"
Daemons
server: rpc.mountd, nfsd
client:rpc.statd, lockd
NFS daemons
/etc/exports
netdaemons
Time daemons /etc/rc.config.d/netdaemons
/etc/ntp.conf
Software
adding packages/patch swinstall -s /var/spool/sw
removing packages/patch swremove
swlist -l product PH* (HPUX 10.x)
Listing installed packages/patches swlist -l patch (HPUX 11)
swlist -l -a state
verify package/patches swverify
Adding packages to depot swlist -d @ /dev/rmt/0m
Removing packages to depot swremove -d * @ /var/spool/sw
swlist -d @ /dev/rmt/0
listing packages from depot swlist -d @ /var/spool/sw
copy software from one depot to another swcopy -s /dev/rmt/0 @ /var/spool/sw
register software swreg
List all files in package swlist -l <file>
configure software swconfig
Log Files
messages n/a
syslog /var/adm/syslog/syslog.log
mail /var/adm/syslog/mail.log
cron /var/adm/cron/log
boot /var/adm/syslog/syslog.log
sam log /var/sam/log/samlog
Accounts
cat /etc/passwd
displaying users logins
useradd
adding a user sam
userdel
removing a user sam
usermod
modifying a user sam
/etc/passwd
password files /tcb/files/auth/r/root (trusted system)
Network
displaying NIC speeds ndd -get
ndd -set
setting NIC speeds lanadmin
display routing table netstat -rn
lanscan (all)
displaying network interfaces ifconfig lan0 (individual)
Lan device config (interface name, state, mjr lanscan
number, Hardware path, mac address)
Lan Diag tool (like a netstat –I and –s and Landiag or lanadmin
more)
setup dns /etc/resolv.conf
name service switch file /etc/nsswitch.conf
NFS Configuration
showmount -e localhost
display nfs shares cat /etc/xtab
/etc/rc.config.d/nfsconf (edit)
create nfs share /etc/exports (edit file & add share)
exportfs -a
/etc/rc.config.d/nfsconf (edit)
exportfs -au (unshare all)
uncreate nfs share exportfs -u /home/vallep
/etc/exports (edit file & remove file)
/sbin/init.d/nfs.core start
nfs start /sbin/init.d/nfs.server start
/sbin/init.d/nfs.client start
/sbin/init.d/nfs.client stop
nfs stop /sbin/init.d/nfs.server stop
/sbin/init.d/nfs.core stop
nfs status ps -ef|grep
nfs reload exportfs -a
nfs performance nfsstat
Sam
Sam Log file location /usr/local/log/samlog
Console
Root only on console /etc/securetty
Boot (ISL)
Boot a particular kernel (standalone) Hpux –is /stand/vmunix
Boot in stanalone Hpux –is boot
Boot multi-user Hpux –lm boot
Disk
setboot -p
setting the boot device setboot -a
format floppy drive n/a
mount/unmount floppy n/a
mount/unmount CDROM mount -rF cdfs /dev/mnt
create boot disk or recovery tape (preview):
recovery tape make_tape_recovery -v -I -x inc_entire=vg00
>boot pri
boot cdrom/diskette Interact with IPL? Y
(single user) ISL>hpux -is
>boot pri
boot into maintenace Interact with IPL? Y
mode ISL>hpux -lm
Display the LIF area (Logical Interchange lifls -l /dev/dsk/c0t6d0
Format)
Display characteristics of a tape drive lssf /dev/rmt/c4t1d0DESTn
Swap
swapinfo (display in Kb)
Display swap information swapinfo -m (display in Mb)
swapinfo -tm (total and Mb)
Adding swap Create logical volume or filesystem
update /etc/fstab
Misc
startup
shutdown -h -g0 -y (halt)
shutdown shutdown -r -g0 -y (reboot)
init status
0
1
2
3
4
5
6
determine the runlevel who -r
obtain default run level
start xwindows
ntp setup
force a fsck
page size (memory) 4Kb
initialize system set_parms initial
Timezone /etc/TIMEZONE
Class:
insf -C tape
update /dev directory Recreate deleted link:
insf -H 0.1.0 -e
remove device rmsf
list device drivers lsdev
console login (allow/deny) /etc/securetty