- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- retrieving history using <ESC> K
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
07-13-2007 06:46 AM
07-13-2007 06:46 AM
Also, is there away to only log commands phyisically typed in from the keyboard to the .sh_history file. Apparently, large ksh scripts that I run log immense data which I don't care about. Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2007 07:15 AM
07-13-2007 07:15 AM
Re: retrieving history using <ESC> K
e.g. export HISTSIZE=100
to store last 100 commands
.sh_history infact logs only commands and not the output, so not to worry.
Regards,
Ninad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2007 07:29 AM
07-13-2007 07:29 AM
Re: retrieving history using <ESC> K
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2007 08:44 AM
07-13-2007 08:44 AM
Re: retrieving history using <ESC> K
Please do echo $HISTFILE
If HISTFILE is not defined to any specific file, then default is .sh_history
Regards,
Ninad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2007 08:48 AM
07-13-2007 08:48 AM
Re: retrieving history using <ESC> K
What file are the commands buffered to because it doesn't appear that the fc -l command or the ESC K command walks .sh_history.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2007 08:55 AM
07-13-2007 08:55 AM
Re: retrieving history using <ESC> K
I have no problems with using
>large ksh scripts that I run log immense data which I don't care about.
You might want to use the following so you don't log functions:
set -o nolog # don't save functions in history file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2007 09:07 AM
07-13-2007 09:07 AM
Re: retrieving history using <ESC> K
much appreicated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2007 09:12 AM
07-13-2007 09:12 AM
SolutionYou could have also solved it by using HISTSIZE=10000 or so. I typically use 1000 but also grep .sh_history for valuable but "expired" commands.
I found nolog because I read every stinkin' word on the man page and I kept seeing my pushd/popd functions logged in HISTFILE.
You haven't assigned any points yet, please read:
http://forums1.itrc.hp.com/service/forums/helptips.do?#33
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2007 09:12 AM
07-13-2007 09:12 AM
Re: retrieving history using <ESC> K
If HISFILE is not set then history is stored in $HOME/.sh_history
If the .sh_history file you are checking is in fact in $HOME, then try one thing -
mv .sh_history .sh_history.org
and then try fc -l
Regards,
Ninad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2007 09:54 AM
07-13-2007 09:54 AM
Re: retrieving history using <ESC> K
BTW - I am not root
Ninad,
Thanks for your posts.
HISTFILE is not set so it is defaulting to ~/.sh_history. I did your test and here are my results of the fc.
meekerr@stp03: /home/vtl/meekerr
==> ls -a .sh_history
.sh_history
meekerr@stp03: /home/vtl/meekerr
==> fc -l
197 asdf asdf asdf
198 asdf
199 asdf
200 hg
201 asdf
202 asdf aasd
203 ia2b
204 man fc
205 fc First
206 man fc
207 cd
208 fc -l
209 ls -a .sh_history
210 clear
211 ls -a .sh_history
212 fc -l
meekerr@stp03: /home/vtl/meekerr
==> mv .sh_history .sh_history.org
meekerr@stp03: /home/vtl/meekerr
==> fc -l
199 asdf
200 hg
201 asdf
202 asdf aasd
203 ia2b
204 man fc
205 fc First
206 man fc
207 cd
208 fc -l
209 ls -a .sh_history
210 clear
211 ls -a .sh_history
212 fc -l
213 mv .sh_history .sh_history.org
214 fc -l
meekerr@stp03: /home/vtl/meekerr
Hmmm - Is there a separate command buffer for command history or is it using .sh_history?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2007 10:20 AM
07-13-2007 10:20 AM
Re: retrieving history using <ESC> K
I'm shure the shell keeps its history in memory - or at least a part of it - so it wouldn'z be necessary to open a file for each key stroke.
mfg Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2007 11:08 AM
07-13-2007 11:08 AM
Re: retrieving history using <ESC> K
You didn't have 3000 lines of functions did you? ;-)
I have 1000 and I can do "history -999". And then grep 9000+ lines.
>Not sure why it is not walking the entire 232 since my HISTSIZE is set to 3000.
I did history to pick a line close to 1000 back and
>Is there a separate command buffer for command history or is it using .sh_history?
I suppose there is an in memory copy? If you have HISTFILE set wrong or root with sh, it doesn't put it to a file.
>Peter: I'm sure the shell keeps its history in memory - or at least a part of it - so it wouldn't be necessary to open a file for each key stroke.
It probably buffers lines? I'm able to see recent commands from other shells.