Operating System - HP-UX
1751894 Members
4777 Online
108783 Solutions
New Discussion юеВ

HP-UX enable history command navigation

 
SOLVED
Go to solution
Renz Malabanan
Frequent Advisor

HP-UX enable history command navigation

The problem is I want to access history of command I typed by using up and down arrows it is not working for some reason.

does it is not supported by hpux v11.11??

thanx for the help!
6 REPLIES 6
Kenan Erdey
Honored Contributor

Re: HP-UX enable history command navigation

Hi,

if you are using sh, esc+k combination gives you history.
Computers have lots of memory but no imagination
Shibin_2
Honored Contributor

Re: HP-UX enable history command navigation

use esc+k combination or user history command.
Regards
Shibin
Bill Hassell
Honored Contributor

Re: HP-UX enable history command navigation

> does it is not supported by hpux v11.11??

This is not an OS question, it is a question concerning the shell you are using. By default, you are probably using the POSIX shell (/usr/bin/sh), or possibly the Korn shell (/usr/bin/ksh). There are two requirements to enable the shell history:

touch $HOME/.sh_history

and export these variables in /etc/profile:

export HISTFILE=$HOME/.sh_history
export HISTSIZE=20000
export EDITOR=/usr/bin/vi

Now exit and login again. Type a command like pwd and then type the command: history. The history command shows your current history file. You recall the last command by type ESC then k. You can search for the most recent command containing a string using ESC /.

Some user may be accustomed to EMACS style recall so they can change that in their personal .profile file. Arrow keys are not functional in the POSIX and ksh shells.


Bill Hassell, sysadmin
Ismail Azad
Esteemed Contributor

Re: HP-UX enable history command navigation

Hi,

Certain things are in built to the K-shell and as Bill mentioned you have to add those three lines for command line history on a POSIX shell that would be /usr/bin/sh or /sbin/sh. You may also try esc and then j if you have crossed the command you wanted to execute , in other words forward... Esc Esc also allows for file name completion. As you see, there are reasons why people prefer bash!

Regards
Ismail Azad
Read, read and read... Then read again until you read "between the lines".....
Viktor Balogh
Honored Contributor

Re: HP-UX enable history command navigation

Hi Renz,

If you only want arrow-key history navigation in ksh, you can set emacs mode in your profile:

set -o emacs

and have these lines also added to your .kshrc :

alias __A='^P'
alias __B='^N'
alias __C='^F'
alias __D='^B'
alias __H='^A'
alias __P='^D'

Let me know if it worked, it should!
****
Unix operates with beer.