Operating System - HP-UX
1754102 Members
3214 Online
108811 Solutions
New Discussion юеВ

Re: Help with History command

 
SOLVED
Go to solution
Chris Fadrowski
Super Advisor

Help with History command

I was wondering if someone could tell me how to configure using k to get your previous commands. I forgot where to set this up and have a new HPUX 11.31 server. I can't remember what file or syntax to use to get this to work. Can someone help me remember?
6 REPLIES 6
mobidyc
Trusted Contributor

Re: Help with History command

Hello,

please check this link:
http://www.unix.com/unix-dummies-questions-answers/17565-ksh-how-make-up-arrow-recall-command-history.html

Cheers,
Cedrick Gaillard
Best regards, Cedrick Gaillard
Kenan Erdey
Honored Contributor

Re: Help with History command

Hi,

put in .profile

EDITOR=vi
export EDITOR

Kenan.


Computers have lots of memory but no imagination
Mel Burslan
Honored Contributor
Solution

Re: Help with History command

your shell needs to be ksh or POSIX (/sbin/sh)
somewhere in your login (/etc/profile for all users or $HOME/.profile for a single user preferably) you will need to set these variables:

HISTSIZE=400 # 400 lines of history gets kept
HISTFILE=$HOME/.sh_history

and after setting these variable, somewhere in the same profile, you need to insert this line:

set -o vi

This should get you going
________________________________
UNIX because I majored in cryptology...
Ganesan R
Honored Contributor

Re: Help with History command

Hi,

run this command.

#set -o vi

After that use "esc+k" key combination to retrieve the previously used commands.

You can set that value in your user profile to make it permenant.
Best wishes,

Ganesh.
Chris Fadrowski
Super Advisor

Re: Help with History command

thank you... adding HISTSIZE and HISTFILE with set -o vi into .profile worked.
Steven E. Protter
Exalted Contributor

Re: Help with History command

Shalom,

Just a short note. Location is important for the HISTFILE.

I've seen it not work when placed on an NFS share with insufficient rights.

The user can alter this data. To properly track it you'll need a cron script to copy the data off to a place the user can't edit it.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com