HP-UX enable history command navigation (10622 Views)
Reply
Frequent Advisor
Renz Malabanan
Posts: 44
Registered: ‎03-13-2011
Message 1 of 7 (10,622 Views)
Accepted Solution

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!
Honored Contributor
Kenan Erdey
Posts: 559
Registered: ‎02-13-2006
Message 3 of 7 (10,622 Views)

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
Honored Contributor
Shibin_2
Posts: 711
Registered: ‎11-11-2005
Message 4 of 7 (10,622 Views)

Re: HP-UX enable history command navigation

use esc+k combination or user history command.
Regards
Shibin
Honored Contributor
Bill Hassell
Posts: 14,225
Registered: ‎05-29-2000
Message 5 of 7 (10,622 Views)

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.
Esteemed Contributor
Ismail Azad
Posts: 487
Registered: ‎11-09-2010
Message 6 of 7 (10,622 Views)

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".....
Honored Contributor
Viktor Balogh
Posts: 1,007
Registered: ‎03-15-2009
Message 7 of 7 (10,622 Views)

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.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.