Thursday, March 20, 2008

HP-UX Command Help Guide

Command Guide :

Navigating options :

  • Esc + k - view previously used commands, press k to view more history commands.

  • press Esc twice - For auto completetion you should press Esc key two times after typed first few characters.

Note : This option will not work on csh, This is good on POSIX shell "/usr/bin/sh" or its subset ksh "/usr/bin/ksh"


    /PATTERN search forward
    ?PATTERN search backwards
    / or ? or n repeat last search
    N reverse last search
    :w write buffer to disk
    :w NEWFILE write buffer to NEWFILE
    :w >> FILE append buffer to FILE
    :w! FILE force a write to FILE
    :wq write then quit
    :q quit
    :q! quit without writing
    :f show file name and line #
    :r read file into buffer
    :r FILE read named FILE
    :e edit
    :e! discard buffer and edit
    :e FILE edit a FILE
    :e # pop between files
    :s/OLD/NEW/ current line sub. 1st
    :s/OLD/NEW/g current line sub. all
    :1,7s/OLD/NEW lines 1-7 sub. all
    :%s/OLD/NEW all lines sub. 1st
    :%s/OLD/NEW/g all lines sub. all
    :%s/^/PATTERN /g insert PATTERN at beginning of line all lines
    :%s/$/ PATTERN/g insert PATTERN at end of all lines
    :set nu show line numbers
    :set nonu hide line numbers
    :set sm enable matching ()s
    :set nosm disable matching ()s

    $ end of line
    ^ beginning of line
    / search
    :%s/.$// remove last character on every line


    a append after cursor
    A append at end of line
    i insert before cursor
    I insert at start of line
    open a line below cursor
    open a line above cursor
    cw change word at cursor
    c#w change # of words
    C change text to end of line
    r replace a character
    R replace text unti
    #a add # copies of text
    #a add # copies of text at line end
    #i insert # copies of text
    #I insert # copies of text at line start
    ^w erase last word
    go to command mode


    h move cursor left
    l move cursor right
    j move cursor down one line
    k move cursor up one line
    G go to end of file
    #G go to line #
    H go to top of screen
    M go to middle of screen
    L go to bottom of screen
    w move cursor forward one word
    b move cursor back one word
    #w move cursor forward # words
    #b move cursor back # words
    F scroll forward one page
    B scroll back one page
    x delete character
    dd delete line
    #dd delete # lines
    dw delete word
    #dw delete # words
    d$ delete to end of line
    P paste before cursor
    p paste after cursor
    "vp paste buffer v after cursor
    xp transpose two characters
    Y yank a line
    #Y yank # lines
    "v#Y yank # lines to buffer v
    . repeat last command
    G show which line on
    u undo


    this was for changing DNS values in the db.* files


    The 'g' at the beginning and end of the command indicate that the changes are to occur horizontally and vertically

Command to view Service Gard related process :

#cmviewcl -v


  • location of syslog file and pk log file :

#tail -n 16 /var/adm/syslog/syslog.log


Normally Pkg log will be in the location :



Check Disk Utilization :



Check large file of a given directory :

find /(name of the directory, without brackets) -type f -size +30000 -exec ls -l {} \; more


To check if the process is running :

ps -ef grep -i (name of the process)


Formula to calculate the nfile parameter :



  • Restarting syslogd process :

Login as root user :

ps -ef grep syslogd

cp -p syslog.log

cd /var/adm/syslog

ls -lrt

/sbin/init.d/syslogd start

# gzip ( Zip the copied file to save the file )

ps -ef grep syslogd


Check if DSS tape is loaded or not :

mt -f status


To enable package switching and start the package :

# cmmodpkg -e ov-server and #cmrunpkg -n nodename ov-server


To be continued....

No comments: