- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- History command
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2010 02:03 AM
04-22-2010 02:03 AM
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2010 02:06 AM
04-22-2010 02:06 AM
Re: History command
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,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2010 02:09 AM
04-22-2010 02:09 AM
Re: History command
export HISTFILE=$HOME/.sh_history
export HISTSIZE=5000
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2010 02:21 AM
04-22-2010 02:21 AM
Re: History command
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2010 02:25 AM
04-22-2010 02:25 AM
Re: History command
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2010 03:37 AM
04-22-2010 03:37 AM
Re: History command
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2010 03:40 AM
04-22-2010 03:40 AM
Re: History command
Are you setting HISTFILE & HISTSIZE in the user's .profile ?
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2010 03:44 AM
04-22-2010 03:44 AM
Re: History command
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!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2010 03:54 AM
04-22-2010 03:54 AM
Re: History command
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2010 03:55 AM
04-22-2010 03:55 AM
Re: History command
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2010 03:59 AM
04-22-2010 03:59 AM
Re: History command
this directory
/root
must exist!
Does it???
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!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2010 04:04 AM
04-22-2010 04:04 AM
Re: History command
export HISTFILE=/.sh_history (if your home is "/"; is it is /root and it exists, put /root/.sh_history)
export HISTFILE=5000
Then, try again by logout/login.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2010 04:11 AM
04-22-2010 04:11 AM
Re: History command
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2010 04:11 AM
04-22-2010 04:11 AM
Solutionumask 022
touch $HOME/.sh_history
export HISTORY=$HOME/.sh_history
export HISTFILE=5000
>> $HOME=/
A very bad default location for root's $HOME. Create a separate /root directory and move all of root's files to /root, then change /etc/passwd so the $HOME directory is /root and not /, like this:
root:*:0:3:root user:/root:/sbin/sh
If you move root's $HOME on every Unix platform you have, you may avoid a total disaster in joining the rm -r * club.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2010 04:25 AM
04-22-2010 04:25 AM
Re: History command
If you simply export these variables and then logout, the change is gone. You need to write it to .profile to make it permanent and working.
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!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2010 04:26 AM
04-22-2010 04:26 AM
Re: History command
# history
sh: fc: Cannot access or open the history file.
# pwd
/
#
#
after exporting HISTFILE AND HISTSIZE logout than login same problem. You tell me from my side what infomation required, so history command work.
Dev
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2010 04:29 AM
04-22-2010 04:29 AM
Re: History command
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!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2010 04:35 AM
04-22-2010 04:35 AM
Re: History command
# echo $SHELL
/sbin/sh
m using shell.
Regards,
Dev
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2010 04:37 AM
04-22-2010 04:37 AM
Re: History command
If you do not put these in root's ".profile" you will lose the variables each time you log out of the system......
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2010 04:38 AM
04-22-2010 04:38 AM
Re: History command
export HISTFILE=/root/.sh_history
export HISTSIZE=5000
to your .profile and do
# mkdir /root
logout and back in.
To change root's home, modify /etc/passwd.
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!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2010 04:39 AM
04-22-2010 04:39 AM
Re: History command
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2010 08:01 AM
04-22-2010 08:01 AM
Re: History command
>> sh: fc: Cannot access or open the history file.
Did you create the .sh_history file?
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2010 08:29 AM
04-22-2010 08:29 AM
Re: History command
If you don't mind, Could you please provide below information?
1. /.profile
2. /etc/profile
3. ls -la / |grep -i history
4. cat /etc/passwd |grep root
Regards,
Sooraj