- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- history .sh_history not working
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
11-09-2001 08:15 AM
11-09-2001 08:15 AM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2001 08:20 AM
11-09-2001 08:20 AM
SolutionMake sure the user's $HOME/.profile contains the following lines:
HISTFILE=$HOME/.sh_history
export HISTFILE
Don't worry about any accounts where the file is absent, that's not a problem. One can remove the file or null it at will.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2001 08:21 AM
11-09-2001 08:21 AM
Re: history .sh_history not working
In your .profile, you need to add:
# Set history on:
export HISTFILE=$HOME/.sh_history
IF ou are using .kshrc then addin .kshrc:
FCEDIT=/usr/bin/vi
export FCEDIT
HISTFILE=$HOME/.sh_history
export HISTFILE
HISTORY=2048
export HISTORY
All the best
Victor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2001 08:25 AM
11-09-2001 08:25 AM
Re: history .sh_history not working
Hi, no need to recreate the accounts. Just add the following in the .profile file
of the user home directories:
***
HISTFILE=$HOME/.sh_history
export HISTFILE
set -o vi
***
History will be made!
-raj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2001 08:25 AM
11-09-2001 08:25 AM
Re: history .sh_history not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2001 08:27 AM
11-09-2001 08:27 AM
Re: history .sh_history not working
$ cd ~amyw
$ touch .sh_history
Make sure HISTFILE=~/.sh_history in the profile.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2001 08:31 AM
11-09-2001 08:31 AM
Re: history .sh_history not working
I strongly urge you to use the Posix shell (/usr/bin/sh) in lieu of the Korn (ksh)shell. The Posix shell is the HP default and is a superset of its Korn (/usr/bin/ksh).
For root, you *MUST* use the Posix shell, but it *MUST* be the staticly linked one ('/sbin/sh'). Failure to follow this rule will lead to an unbootable system.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2001 08:32 AM
11-09-2001 08:32 AM
Re: history .sh_history not working
Yes.
Regards,
Hai
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2001 08:42 AM
11-09-2001 08:42 AM
Re: history .sh_history not working
Yes, you can use .sh_history with the posix shell as well. I set it up like this (though I don't claim it is the definitive answer):
To set it up for root (shell is /sbin/sh):
export EDITOR=vi
export HISTFILE=$HOME/.sh_history
export HISTSIZE=128
To set it up for a user (shell is /usr/bin/sh):
set -o vi
These are in the .profile for my users. Also, for some reason which I don't remember, I set EDITOR for normal users. You can change HISTFILE and HISTSIZE to suit your needs.
Darrell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2001 09:43 AM
11-09-2001 09:43 AM
Re: history .sh_history not working
Use
set -o vi
in the .profile of the user.
Hope this helps.
Regds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2001 11:40 AM
11-09-2001 11:40 AM
Re: history .sh_history not working
Adding:
export HISTSIZE=1000
export EDITOR=/usr/bin/vi
to /etc/profile will round out the use of the command history capability.
NOTE: exporting HISTFILE will cause the POSIX shell (/usr/bin/sh and /sbin/sh), the Korn shell (/usr/bin/ksh) and even non-standard shells like bash to start using the shell history file. Many user refuse to use the POSIX shell because is is mistaken for the Bourne shell (sh) when it is a superset of ksh. Once HISTFILE is set, most users won't notice the difference.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2001 07:10 PM
11-09-2001 07:10 PM
Re: history .sh_history not working
Since you mention that you want to monitor some user accounts, you should know that theres nothing to stop a user from manually editing or even deleting his history file.
Just remember that your script may come up against some blank history files.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2001 12:03 PM
11-10-2001 12:03 PM
Re: history .sh_history not working
we did have some *issues* with home-directories on NFS servers, due to problems with the file-locking.
Are those users unable to use the "$HOME/.sh_history" NFS-based?
Just my $0.02,
Wodisch
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2001 10:23 AM
11-11-2001 10:23 AM
Re: history .sh_history not working
Adding following lines will create history file in user's home directory.
export HISTFILE=$HOME/.sh_history
The size of history file can be controlled using following in same .profile file.
export HISTSIZE=1024
Thanks.
Prashant.