HP-UX Overview and Command Summary
HP-UX Overview and Command Summary
Bootup/Shutdown
Configuration Menu
Information Menu
Service Menu
GSP Mode
1. shutdown -r 0
2. hit <space> during 10 sec window to interrupt reboot
3. enter: <b><o>
4. interact with ipl? yes
5. hpux -is (i=init, s=single user)
1. shutdown -r 0
2. <space> during 10 sec window
3. bo
4. interact with ipl --> yes
5. hpux -is (i=init, s=single user mode)
6. mount -a
7. init 3
Startup/Shutdown Scripts
/sbin/init.d
/sbin/rc0.d These are all linked to actual scripts in /sbin/init.d
/sbin/rc1.d
/sbin/rc2.d scripts with k are kill scripts and scripts with s are start scritps.
/sbin/rc3.d
/sbin/rc4.d
CIFS (Samba)
/opt/etc/samba/smb.conf
Device Management
HP-UX is a hardware path based operating system. When it boots up it does a hardware detection. It then
compares the hardware that it detects with the hardware that is listed in /etc/ioconfig. If new hardware is
detected, it is assigned the next available configuration information in the proper hardware path.
insf -C disk -e <-- This command will re-install all of the device files for the class "disk"
ioscan <-- searches for all devices and displays their hardware path
ioscan -fnC disk <-- searches for all devices of class (C) disk
ioscan -fnH <LUN> <-- searches for a LUN
Disk Devices
scsictl -a /dev/rdsk/c?t?d? <-- display control parameter information about the disk device
scsictl -a -m queue_depth=4 -m queue_depth /dev/rdsk/c?t?d? <-- sets the queue depth
CD-ROM Devices
1. pfs_umount -c OR
2. kill -9 pfs_mountd and kill -9 mountd
ls -l /dev/fc*
Login Environment
/etc/profile.env
export TMPDIR=/tmpsort
export TEMPDIR=/tmpsort
Changing prompt:
This gives a prompt that has the hostname followed by the current directory, ending in the # (useful for root
logins).
Networking
netstat -a <--ports
netstat -i <--interfaces
netstat -r <--routing table
netstat -rv <--routing table and subnet mask
ioscan -fnkC lan - shows ioscan information for device type "lan"
lanscan -i|awk '{print $1}'|xargs -i ifconfig {} -> does an ifconfig on all defined interfaces on that server
cd rc.config.d
vi netconf
ntpq -p --> lists ntp peers and their time sync status
ntpq -p <server fqdn or ip address> --> lists time sync status with that server (slightly different detail than
ntpq -p)
/sbin/init.d/xntpd stop
/sbin/init.d/xntpd start
Printing
Command Description
cancel deletes print jobs from queue
hppi jet admin
ls -d<destination> -o<optioni> prints a file
file
lpadmin
lpsched -v
lpstat lists jobs in queue. -s -t
pr .profile | lp -n3 prints
pr -o10 -l64 -F -h prints using margins of 10, page length of 64, header on each page
<HEADER> <file> | lp
/etc/lp
/usr/lib/lp
/var/adm/lp
/var/spool/lp
/var/sam/lp/lpinfo
Migrating the printer configuration from one server to another server using SAM:
SAM --> Printers & Plotters --> LP Spooler --> Save/Restore Spooler Configuration
Actions --> Save Spooler Configuration
This saves the information in the directory /var/sam/lp
Save this directory using tar: "tar -cvf /tmp/lp.tar /var/sam/lp"
Copy this tar file to the destination server
Performance Monitoring
top
j moves forward pages in the display
k moves backwared pages in the display
glance (if installed)
sar -q
sar -u
sar -d
vmstat
vminfo
Process Management
Command Description
inetd -c Causes inet to reload /etc/inetd.conf
inetd -l starts logging in /var/adm/syslog/syslog.log
ps -ef | grep PROD list all processes, but only show those processes that have "PROD" in
them
/sbin/init.d/<script> [start|stop] If the script exists, this will stop and start the associated processes.
Remote Access
remsh <host>
rlogin <host>
.rhosts file needs to be configured or else you will be prompted for username and password (located in home
directory)
last -R - gives address information of last remote login, useful for troubleshooting
-x mount_all_filesystems=false
-x logdetail=true
-x loglevel=2
Note:
To install a depot you must specify the complete path to the depot and the depot name.
To install patches you must specify the complete path to the directory that has the patch files.
Location of logfiles:
/var/adm/sw/swagent.log
/var/adm/sw/swinstall.log
cleanup
cleanup -c n <-- commits patches that have been superseded n number of times. Useful to free up disk
space in /var/adm/sw/save.
cleanup -p <-- previews the actual cleanup tasks but does not actually perform the cleanup
check_patches
show_patches
From the directory that has all of the individual depots run this command line script:
for i in PH*.depot
do
swcopy -x enforce_dependencies=false -s ${PWD}/$i \* @ /tmp/patch_depot <--
/tmp/patch_depot is the destination directory
done
System Information
Note: See section on STM, detailed system information is available with this utility
Also SAM -->Performance Monitors --> System Properties
OS Information
uname -a - display general information e.g. OS release, node name, machine ID number, etc
Memory Information
dmesg|grep Phy <-- List amount of physical ram in server
cat syslog|grep Phy <-- List amount of physical ram in server
echo phys_mem_pages/D|adb -k /stand/vmunix /dev/kmem <-- Lists amount of 4K Memory pages in
HPUX 11.x
echo "memory_installed_in_machine/D" | adb -k /stand/vmunix /dev/mem |tail -1 | awk '$2 > 0 { print $2 /
256 }' <-- Lists memory in MB.
echo "physmem/D" | adb /stand/vmunix /dev/kmem <-- Lists amount of 4K Memory pages in HPUX 10.x
sam --> Performance Monitors --> System Properties --> Memory Tab
CPU Information
ioscan -fnC processor <-- shows information about each processor found
echo "itick_per_usec/D" | adb -k /stand/vmunix /dev/mem | tail -1 <-- Shows CPU Speed in MHZ
Using set_parms --> may not work correctly for multiple nics
set_parms hostname ( a reboot is required for the change to take effect)
It will prompt you for the new hostname
It will prompt you to reboot (answer no if you are also changing the ip address)
set_parms ip_address ( a reboot is required for the change to take effect)
It will prompt you for the new ip address
It will prompt you to reboot
Manually makiing the change:
vi /etc/hosts
vi /etc/rc.config.d/netconf <-- ** Make sure that no extra files are in the /etc/rc.config.d
directory - it gets sourced on bootup
reboot
Other files that may need to checked/changed
/etc/resolv.conf
/etc/nsswitch.conf
System Tuning
Extract Current System File
cd /stand/build
/usr/lbin/sysadm/system_prep -s /stand/build/system
file is called system
section called "Tunable Parameters"
STM
diaglogd
/var/opt/resmon/log
cstm -f /tmp/disk.stm
Terminal Environment
/usr/share/lib/terminfo
$DISPLAY=192.168.70.80:0.0
$TERM = xterm
stty
stty -all
Terminal Ports
Port 1
Datacommunications
25 Pin - use this to connect to the N class server with a 25 pin to 9 pin cable
Port 2 - used to connect to an external peripheral
Parallel
25 Pin
Port 3
Datacommunications
9 Pin - use this port to connect to the A class server with a 9 pin to 25 pin cable
Terminal Configuration Settings
Press User/System function key
modes
Remote Mode must have an asterisk in it's box (indicating it is selected)
config keys
datacomm config
baud rate 9600
parity: none/8
xon/xoff
terminal config
serial (2)/parallel(1) - 25 pin console port
serial (1)/parallel(1) - 9 pin console port
Term ID - vt100
Term Mode - em100
ansi config
em100
backspace/del
Users Administration
Creating Users
Creating Groups
sam --> user and group accounts
groupadd Groupname
Useful Commands
Command Description
<esc><esc> or <esc>\ autocompletion
file * Show file types, such as "ascii".
find <path> -name <name> - Finds a file in the OS at the starting path on down
print
grep
groups <username> Shows groups for a user
kmtune Displays kernel tunable parameters
listusers -g <group> Lists the users in a group
ln -s <file or directory> Creates a symbolic link to a file or a directory
<symbolic link>
pr -o10 -l64 -F -h prints using margins of 10, page length of 64, header on each page
<HEADER> <file> | lp
rcp <source> remote_machine: remote copy
<path>
remsh <host> opens a remote command shell on the host machine
rlogin <host> remote login to host machine
sar
set_parms Change host name (/etc/set_parms)
tail -f <file> Looks at end of file and keeps it open to watch changes
top realtime display of processes
uname -a information about the system
print $(uname -i)16op|dc prints hex system id
who -u, who -Rm who is using the system
Oracle Procedures:
I have a need to remove some semaphores and a memory segment from a sun box to clean up a failed Oracle
instance. The server has several Oracle Instances and allocated memory segments and I need to identify the
proper one to 'ipcrm -m' on.....Does anyone know how I get more detail as to the owner of the segments?
Thanks,
Thomas
Unfortunately I was using that syntax to begin with and only gets me limited data, however by ipcs -pmb and
ipcs -sa I was able to identify all oracle semaphore id's and memory segment id's. Then by connecting to the
surviving instances, doing a dump of that instance memory and semaphore maps, I was able to determine
which id's not to remove from memory, thus enabling me to clean up the failing instance memory.
Thanks,
Thomas