Difference between revisions of "HP-UX"

From Mesopoly 3.0
Jump to navigation Jump to search
 
(30 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:Technical]]
+
[[Category:Technical]][[Category:HP-UX]][[Category:HP]]
This page is a byproduct of [[Zlatko|me]] getting ready for [http://www.hp.com/education/courses/hp0-091.html HP-UX CSA exam (hpo-091)]. I have more previous knowledge in Linux, so what I point out here would be HPUX specifics and bits and pieces needed to be adopted by me with the end of systematization of my knowledge.
+
This page is a byproduct of [[Zlatko|me]] getting ready for [http://www.hp.com/education/courses/hp0-091.html HP-UX CSA exam (hpo-091)]. It may split into more pages latter. I have previous knowledge of Linux, so what I point out here would be HPUX specifics and not neccesary basic and most relevant stuff.
  
I am making notes as I go through [http://amazon.com/exec/obidos/asin/0131448544/mainthinginwebci|HP-UX CSA: Official Study Guide and Reference].  
+
I am making notes here as I go through [http://amazon.com/exec/obidos/asin/0131448544/mainthinginwebci|HP-UX CSA: Official Study Guide and Reference].  
  
 
==links==
 
==links==
Line 8: Line 8:
 
*[http://www.faqs.org/faqs/hp/hpux-faq/preamble.html HP-UX faq]
 
*[http://www.faqs.org/faqs/hp/hpux-faq/preamble.html HP-UX faq]
 
*[http://www.unixguide.net/cgi-bin/unixguide.cgi UnixGuide] compare various Unixes
 
*[http://www.unixguide.net/cgi-bin/unixguide.cgi UnixGuide] compare various Unixes
 +
*[http://www.hp.com/education/sections/hpux.html HP-UX at HP] includes courses and some PDF matrial for download
 +
 
==tips and notes==
 
==tips and notes==
====shell - system====
+
====shell====
 
*misc
 
*misc
 
**<tt>posix</tt> is default shell in <tt>hpux</tt>
 
**<tt>posix</tt> is default shell in <tt>hpux</tt>
 +
**<tt>rsh</tt> : restritcted shell
 +
**<tt>Key shell</tt> : key shell, context sensitive shell
 
*files
 
*files
 
**<tt>.sh_history .profile</tt> controled by HISTFILE variable
 
**<tt>.sh_history .profile</tt> controled by HISTFILE variable
 
*commands  
 
*commands  
**extrinsic or intrinsic to the shell
+
**Line completition : Esc Esc
**<tt>history</tt> use Esc+K to navigate, shows last 15 commands by default
+
**<tt>history</tt> use Esc+K to navigate, shows last 15 commands by default <tt>r fc</tt>
** <tt>lock alias whoami who w logname uname getconf id banner cal</tt>
+
** <tt>ulimit lock alias whoami who w logname uname getconf id banner cal stty ttytype jobs fg bg wait</tt>
 +
 
 +
====shell programming====
 +
*commands
 +
**<tt>shift read exit break continue</tt>
 +
**<tt>let</tt> or (( ))
 +
**<tt>test</tt> or [[ ]]
 +
*loops
 +
**for do done
 +
**while do done
 +
**until do done
 +
*variables
 +
**<tt>$?</tt> exit code from last program
 +
**<tt>$$</tt> PID of the shell
 +
 
 
====files & directories====
 
====files & directories====
 
*misc
 
*misc
Line 30: Line 48:
  
  
*I/O redirection
+
====I/O redirection====
*to redirect Standard Error to a file use ...
+
*data streams - <tt>stdin stdout stderr</tt>
2>
+
** > standard output, file descriptor '1'
.. instead of usuall
+
** < standard input, file descriptor '0'
>
+
** 2> standard error, file descriptor '2'
 +
 
 +
*syntax
 +
**<tt>2>&1|</tt> pipe stderr and stdout to ..
 +
*<tt>tee</tt>
 +
 
 
====environment variables====
 
====environment variables====
*environment and shell
+
*environment (global) and shell (local)
**environment
+
** difference - environment variables are inherited from parent proccess (shell) ..
 +
*syntax
 +
**<tt>$ VARX=SomeValue
 +
**$ echo $VARX
 +
** $ VARX="$VARX addblah"
 +
** $ VARX=`command`</tt> (Bourne, POSIX)
 +
** <tt>$ VARX=$(command)</tt>
 +
** <tt>export VARX</tt> promotes shell variable to environment variable
 +
*commands
 +
**<tt>set unset alias whence export</tt>
 +
*misc
 +
** single quotations takes 'as is' value, not variable value
 +
** predefined (<tt>PATH HOME PWD SHELL TERM PS1 PS2 MANPATH TZ EDITOR LOGNAME</tt>)
 +
 
 +
====file permissions====
 +
*commands <tt>umask</tt>
 +
*misc
 +
** SETUID SETGID - to run exe file as user of file
 +
*syntax
 +
**<tt>chmod u+s file<tt> or <tt>chmod 2777 file</tt> for setting SETUID (4 for SETGID, 1 for Sticky Bit)
  
 
====VI commands====
 
====VI commands====
Line 44: Line 86:
 
<tt>:m n</tt>  move current line to after line n
 
<tt>:m n</tt>  move current line to after line n
 
<tt>:t n</tt>  copy current line to after line n
 
<tt>:t n</tt>  copy current line to after line n
 +
 
====kernel reconfiguration====
 
====kernel reconfiguration====
 +
*<tt>sysdef</tt> (and <tt>kmtune</tt>: shows tunable kernel parameters
 
*<tt>cd /stand/build</tt>
 
*<tt>cd /stand/build</tt>
*/usr/lbin/sysadm/system_prep -s system - creates <tt>/stand/build/system</tt> as configuration file with parameters taken from running system
+
*<tt>/usr/lbin/sysadm/system_prep -s system</tt> - creates <tt>/stand/build/system</tt> as configuration file with parameters taken from running system
** kmtune -S /stand/build/system - queries system parameters
+
** <tt>kmtune -S /stand/build/system</tt> - queries <tt>system</tt> for kernel parameters
** kmtune -S /stand/build/system -s maxusers=30 - sample setting value of a parameter  
+
** <tt>kmsystem -S /stand/build/system</tt> - which modules would be in new kernel
** kmsystem -S /stand/build/system -q ps2 - queries <tt>system</tt> for the status of <tt>ps2</tt> value
+
** <tt>kmtune -S /stand/build/system -s maxusers=30</tt> - sample setting value of a parameter  
** kmsystem -S /stand/build/system -c Y ps2 - changes value of ps2 to Yes  
+
** <tt>kmsystem -S /stand/build/system -q ps2</tt> - queries <tt>system</tt> file for the status of <tt>ps2</tt> value
** kmadmin
+
** <tt>kmsystem -S /stand/build/system -c Y ps2</tt> - changes value of ps2 to Yes  
*mk_kernel -s ./system - builds new kernel using <tt>system</tt> as configuration file  
+
** <tt>kmadmin</tt>
 +
*<tt>mk_kernel -s ./system</tt> - builds new kernel using <tt>system</tt> as configuration file. Creates file <tt>/stand/build/vmunix_test</tt>.
 +
*<tt>kmupdate</tt> - schedules movement of newly built <tt>vmunix_test</tt> to <tt>/stand/</tt> on next reboot. Directory <tt>/stand/build/system/</tt> has to be moved manually.
 +
 
 
====devices====
 
====devices====
 
*types of files - regular files, directories, devices, links, sockets, named pipes
 
*types of files - regular files, directories, devices, links, sockets, named pipes
Line 122: Line 169:
 
*commands <tt>iostat vmstat netstat lanadmin top sar prmavail, Glance Plus UX, Perfview</tt>
 
*commands <tt>iostat vmstat netstat lanadmin top sar prmavail, Glance Plus UX, Perfview</tt>
 
====LAN interface====
 
====LAN interface====
 +
{|
 +
|- align="center"
 +
|<b>network</b>
 +
|<b>speed</b>
 +
|<b>length</b>
 +
|<b>cable</b>
 +
|<b>repeaters</b>
 +
|- align="center"
 +
|10BASE-2 ethernet
 +
|10 Mb/s
 +
|185m
 +
|50 Ohm thin coaxial
 +
|4
 +
|- align="center"
 +
|10BASE-5 ethernet
 +
|10 Mb/s
 +
|500m
 +
|50 Ohm thick coaxial
 +
|
 +
|- align="center"
 +
|10BASE-T
 +
|10 Mb/s
 +
|100m
 +
|twisted pair
 +
|
 +
|- align="center"
 +
|100BASE-T
 +
|100 Mb/s
 +
|100m
 +
|twisted pair
 +
|
 +
|- align="center"
 +
|100VG-AnyLAN
 +
|100 Mb/s
 +
|
 +
|
 +
|
 +
|- align="center"
 +
|1000BASE-T
 +
|1000 Mb/s
 +
|100m
 +
|
 +
|
 +
 +
|}
 
*terminology
 
*terminology
 
**DLPI - Data Link Provider Service
 
**DLPI - Data Link Provider Service
 
*commands <tt>lsdev ioscan lanscan ifconfig netstat ndd linkloop</tt>
 
*commands <tt>lsdev ioscan lanscan ifconfig netstat ndd linkloop</tt>
 
*files <tt> /etc/rc.config.d/hpetherconf hpbtlanconf nddconf</tt>
 
*files <tt> /etc/rc.config.d/hpetherconf hpbtlanconf nddconf</tt>
 +
 
====Samba====
 
====Samba====
 
*commands <tt>smbclient smbstatus cifsmount ciflist</tt>
 
*commands <tt>smbclient smbstatus cifsmount ciflist</tt>
 +
 +
==hpux recipes==
 +
 +
*<b>hpux history</b> When attempting to make use of <tt>history</tt> file I was presented with <br>
 +
<tt>sh: fc: Cannot access or open the history file.</tt>
 +
 +
 +
To fix this file <tt>.profile</tt> has to be edited. Add following two lines.<br>
 +
<tt>
 +
HISTFILE=/.sh_history  <br>                                               
 +
export HISTFILE  </tt>
 +
 +
==HP-UX abbreviations==
 +
*VSE - Virtual Server Environment
  
 
==to do yet==
 
==to do yet==

Latest revision as of 13:50, 13 November 2006

This page is a byproduct of me getting ready for HP-UX CSA exam (hpo-091). It may split into more pages latter. I have previous knowledge of Linux, so what I point out here would be HPUX specifics and not neccesary basic and most relevant stuff.

I am making notes here as I go through CSA: Official Study Guide and Reference.

links

tips and notes

shell

  • misc
    • posix is default shell in hpux
    • rsh : restritcted shell
    • Key shell : key shell, context sensitive shell
  • files
    • .sh_history .profile controled by HISTFILE variable
  • commands
    • Line completition : Esc Esc
    • history use Esc+K to navigate, shows last 15 commands by default r fc
    • ulimit lock alias whoami who w logname uname getconf id banner cal stty ttytype jobs fg bg wait

shell programming

  • commands
    • shift read exit break continue
    • let or (( ))
    • test or [[ ]]
  • loops
    • for do done
    • while do done
    • until do done
  • variables
    • $? exit code from last program
    • $$ PID of the shell

files & directories

  • misc
    • file names can be 256 characters long
  • commands
    • cat more pg pr ls lsf file grep
  • syntax
    • mv file1 file2 dir/
    • find use for example with -name -size -atime -mtime -perm -type -exec
  • files
    • /etc/magic


I/O redirection

  • data streams - stdin stdout stderr
    • > standard output, file descriptor '1'
    • < standard input, file descriptor '0'
    • 2> standard error, file descriptor '2'
  • syntax
    • 2>&1| pipe stderr and stdout to ..
  • tee

environment variables

  • environment (global) and shell (local)
    • difference - environment variables are inherited from parent proccess (shell) ..
  • syntax
    • $ VARX=SomeValue
    • $ echo $VARX
    • $ VARX="$VARX addblah"
    • $ VARX=`command` (Bourne, POSIX)
    • $ VARX=$(command)
    • export VARX promotes shell variable to environment variable
  • commands
    • set unset alias whence export
  • misc
    • single quotations takes 'as is' value, not variable value
    • predefined (PATH HOME PWD SHELL TERM PS1 PS2 MANPATH TZ EDITOR LOGNAME)

file permissions

  • commands umask
  • misc
    • SETUID SETGID - to run exe file as user of file
  • syntax
    • chmod u+s file or chmod 2777 file for setting SETUID (4 for SETGID, 1 for Sticky Bit)

VI commands

I - insert at ther begginig of the line 3,404w file.txt write lines 3 to 404 to file.txt :m n move current line to after line n :t n copy current line to after line n

kernel reconfiguration

  • sysdef (and kmtune: shows tunable kernel parameters
  • cd /stand/build
  • /usr/lbin/sysadm/system_prep -s system - creates /stand/build/system as configuration file with parameters taken from running system
    • kmtune -S /stand/build/system - queries system for kernel parameters
    • kmsystem -S /stand/build/system - which modules would be in new kernel
    • kmtune -S /stand/build/system -s maxusers=30 - sample setting value of a parameter
    • kmsystem -S /stand/build/system -q ps2 - queries system file for the status of ps2 value
    • kmsystem -S /stand/build/system -c Y ps2 - changes value of ps2 to Yes
    • kmadmin
  • mk_kernel -s ./system - builds new kernel using system as configuration file. Creates file /stand/build/vmunix_test.
  • kmupdate - schedules movement of newly built vmunix_test to /stand/ on next reboot. Directory /stand/build/system/ has to be moved manually.

devices

  • types of files - regular files, directories, devices, links, sockets, named pipes
  • major and minor device number
    • major device number stands for driver used for device
    • minor device number is defined by physical location and device specifics..
  • character and block device
    • named character or raw device file
      • for serial data transfer
      • on ls -al first letter is c
    • block devices
      • moves blocks to buffer and writes after sync executed by syncer daemon
      • on ls -al first letter is b
  • device hardware address

c t d

  • mknod syntax

disks / file systems

  • pvdisplay
    • use block device file as argument
  • vgdisplay
    • uses volume group device as argument f.e. /dev/vg00
  • lvdisplay
    • uses logical volume block device as argument
  • mediainit
    • formats disk and confirms integrity. uses raw / character device file!
  • pvcreate
    • creates physical volume using raw device file
  • vgcreate - creating volume group
    • mknod /dev/vg02/group c 64 0x020000
    • vgcreate /dev/vg02 /dev/dsk/c2t5d0
  • vgextend
  • lvcreate
    • f.e. lvcreate -L 500 -n masopust vg02 creates logical volume of size 500mb named mosopust in volume group vg02
  • vgdisplay
  • lvextend
  • lvreduce
  • lvdisplay
  • extendfs - with Advanced JFS fsadm can be used without unmounting
  • vgscan - manages volumes in /etc/lvmtab
  • lvreduce pvchange pvremove vgremove vgreduce vgexport vgimport lvlnboot lvsplit lvmerge vgcfgbackup vgcfgrestore vxtunefs vxupgrade


  • metadata - superblock, inodes, directory area
  • fstyp
  • newfs
  • mount
  • fuser - manages processes / use of filesystem. Useful if you want to unmount filesystem.
  • bdf

backup

  • commands tar sfbackup/frecover dd

users management

  • id groups newgrp rsh pwck grpck vipws

processes

  • nice renice timex trap

printing

  • lp lpstat cancel lpalt rlpdaemon rmodel lpsched lpshut lpadmin accept LPDEST lpmove enable disable reject accept lpfence lpana

memory and swap

  • daemons swapper vhand
  • commands swapon swapinfo

automation

  • commands cron crontab at batch

performance and optimization

  • commands iostat vmstat netstat lanadmin top sar prmavail, Glance Plus UX, Perfview

LAN interface

network speed length cable repeaters
10BASE-2 ethernet 10 Mb/s 185m 50 Ohm thin coaxial 4
10BASE-5 ethernet 10 Mb/s 500m 50 Ohm thick coaxial
10BASE-T 10 Mb/s 100m twisted pair
100BASE-T 100 Mb/s 100m twisted pair
100VG-AnyLAN 100 Mb/s
1000BASE-T 1000 Mb/s 100m
  • terminology
    • DLPI - Data Link Provider Service
  • commands lsdev ioscan lanscan ifconfig netstat ndd linkloop
  • files /etc/rc.config.d/hpetherconf hpbtlanconf nddconf

Samba

  • commands smbclient smbstatus cifsmount ciflist

hpux recipes

  • hpux history When attempting to make use of history file I was presented with

sh: fc: Cannot access or open the history file.


To fix this file .profile has to be edited. Add following two lines.
HISTFILE=/.sh_history
export HISTFILE

HP-UX abbreviations

  • VSE - Virtual Server Environment

to do yet

  • cut
  • tee - sends output of pipe to additional place (file as well as stout f.e.)
  • 'hardware path'