Thomas Vogt’s IT Blog

knowledge is power …

HP-UX 11i comfortable shell environment

By default the HP-UX 11i (11.23, 11.31) has an inconvenient shell environment. But it is very easy to make the environment usable.

1. Configure shell history and set an assistant command prompt:

# vi ~/.profile

HISTSIZE=1024
HISTFILE=$HOME/.sh_history
PS1=”[`logname`@`hostname` “‘${PWD}]#’
export HISTSIZE HISTFILE PS1

Now the previous commands can be listed with the history command or directly called on the command line with Esc”-“ and Esc”+”.

2. Set the Erase character to Backspace instead of Esc-H (default):

# vi ~/.profile

OLD: stty erase “^H” kill “^U” intr “^C” eof “^D”
NEW: stty erase “^?” kill “^U” intr “^C” eof “^D”

With that environment HP-UX is almost an easy-to-use Unix system ;-))

May 14, 2008 - Posted by | HP, HP-UX, Unix

8 Comments »

  1. Chapped says : I absolutely agree with this !

    Comment by chapped | June 2, 2008 | Reply

  2. Thanks A lot for sharing.Keep continuous

    Comment by khalid | November 10, 2008 | Reply

  3. Other way to make it easy-to-use:
    1) set yr home shell to ksh
    2) set ‘export EDITOR=vi’

    That would take care of the history file etc.

    Comment by TPC | November 27, 2008 | Reply

  4. Better yet:

    1) make shell ksh: chsh self /bin/ksh
    2) set login editing to vi after logging in: set -o vi
    3) export VISUAL=vi EDITOR=vi
    4) export HISTFILE=/tmp/.sh_history.$LOGNAME HISTSIZE=500
    5) set pager to more: export PAGER=more

    (don’t worry about using more: it’s actually much more usable than the historical UNIX more)

    This set of changes helps a lot.

    Comment by ddouthitt | January 1, 2009 | Reply

  5. As mentioned in the comments, some one is recommending to change the shell for the root user to /bin/ksh.

    – Please note: In the case of server problems, and booting into single-user mode, the /bin symlink of /usr/bin is not mounted as default.

    If you want to use ksh shell for root, copy ksh from /usr/bin/ksh into /sbin/ksh and use the /sbin/ksh as your shell in the passwd file.

    Comment by Johnny Damtoft | May 11, 2009 | Reply

    • @Johnny Damtoft: copying anything from /usr/bin just doesn’t solve your problem in case you must boot the system into single user mode: the binaries under /sbin are compiled statically linked libraries: that means, all the required libs are encountered in the resulting binary. If you copy /usr/bin/ksh to /sbin, it won’t start until you mount /usr which contains the required libs.

      Comment by ViktorBalogh | October 25, 2011 | Reply

  6. Hi! I was surfing and found your blog post… nice! I love your blog. 🙂 Cheers! Sandra. R.

    Comment by sandrar | September 10, 2009 | Reply

  7. Thanks, this was helpful.

    Comment by zsombor | November 17, 2011 | Reply


Leave a comment