1753821 Members
9491 Online
108805 Solutions
New Discussion юеВ

Re: History command

 
SOLVED
Go to solution
DKC
Advisor

History command

Hi Flock,

I am working in HPVM machine, OS 11.31 and I want to see previous command for that i am given history command but i got error.
# history
sh: fc: Cannot access or open the history file.

Anyone can assist me why history command are not working.

Thanks & Regards,
Dev
22 REPLIES 22
R.O.
Esteemed Contributor

Re: History command

Hi,

Put these variables in your .profile:

export HISTFILE=$HOME/sh_history
export HISTSIZE=5000

Then, logout and login again and you will have the command history enabled.

Regards,
"When you look into an abyss, the abyss also looks into you"
R.O.
Esteemed Contributor

Re: History command

Sorry, missed a dot in front of sh_history:

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

Regards,
"When you look into an abyss, the abyss also looks into you"
DKC
Advisor

Re: History command

Hi R.O.

I have done all the task but still a getting error
Value of TERM has been set to "xterm".
WARNING: YOU ARE SUPERUSER !!

#
#
# history
sh: fc: Cannot access or open the history file.

after exporting histsize and histfile i have logout and than login but same error.

Regards,
Dev
Pete Randall
Outstanding Contributor

Re: History command

Is $HOME set? "echo $HOME" will tell you.

Try setting HISTFILE to a explicit full path name wherever root's home really is, like "HISTFILE=/.sh_history" or "HISTFILE=/root/.sh_history".


Pete

Pete
DKC
Advisor

Re: History command

Hi Pete,

echo $ HOME
/

After that i have given HISTFILE=/root/.sh_history

but still i am facing error.

# history
sh: fc: Cannot access or open the history file.

Regards,
Dev
R.O.
Esteemed Contributor

Re: History command

Hi,

Are you setting HISTFILE & HISTSIZE in the user's .profile ?

Regards,
"When you look into an abyss, the abyss also looks into you"
Torsten.
Acclaimed Contributor

Re: History command

If you set

HISTFILE=/root/.sh_history


do you have

/root ???

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Pete Randall
Outstanding Contributor

Re: History command

If "echo $HOME" tells you /, as you say, then you should not be setting HISTFILE to /root/.sh_history. Set it to /.sh_history and try again.


Pete

Pete
DKC
Advisor

Re: History command

Hi,

No, I haven't set in users profile.

I am root user and want to previous command with the help of history command. For that i done export HISTFILE=/root/.sh_history
HISTFILE=500
Than logout than again login with root use but after giveing history command same error.

Regards,
Dev