History Command

 
SOLVED
Go to solution
CU_1
Occasional Advisor

History Command

when I run history command this message appear:
sh: fc: Cannot access or open the history file.
5 REPLIES 5
Pete Randall
Outstanding Contributor

Re: History Command

Try this:

echo $HISTFILE


Pete

Pete
Pete Randall
Outstanding Contributor

Re: History Command

Sorry, I should have thought a bit before I hit submit. ;^(

If the above echo statement does return a value for histfile, check the file's permissions.


Pete

Pete
CU_1
Occasional Advisor

Re: History Command

Pete
thank you for response
It gives parameter not set
Dennis Handly
Acclaimed Contributor

Re: History Command

>It gives parameter not set

Then you should export HISTFILE and HISTSIZE and restart your shell.
Bill Hassell
Honored Contributor
Solution

Re: History Command

> It gives parameter not set...

This is a very common problem for every HP-UX system. These two commands are missing from /etc/profile:

export HISTFILE=$HOME/.sh_history
export HISTSIZE=10000

Then for the root user, type:

umask 077
touch $HOME/.sh_history

This is required only for root - other users can use history immediately after they login. Now logout and log back in as root and type a simple command like pwd followed by: history. Since history is used a lot, I like to create an additional alias in .profile like this:

alias h='fc -l'

Now I just type h to get a history.


Bill Hassell, sysadmin