Purging an 8MB .history file (tcsh)

tsreyb_at_yahoo.com
Date: 08/09/05


Date: 9 Aug 2005 11:54:11 -0700

My shell is tcsh. I have an 8M .history file, which I've determined to
be the cause of a 3-5 second delay every time I login to my systems.

Also, my home directory is on an NFS server and is used as my home
directory for several different systems.

I don't know why .history is so large. I use these in my .cshrc:

set history=4096
set savehist=($history merge)

[that's an average of 2000 characters per history command - which just
doesn't make sense. I suspect the file is corrupt]

My goal is to rename (or clear out) my .history file on a regular
basis, keeping .history filesize small enough that my logins don't have
the 3-5 second delay.

However, it appears the solution isn't as simple as renaming or
removing the file, because the next time I log out the 8M file
reappears. I assume this is because the tcsh instance I used to rename
the file had cached the entire .history file in its own memory and
dumped it back out to disk when I exited that shell session.

For a one-time fix, I can make sure I have only one active tcsh login,
do 'set savehist=0' and then exit that shell.

However, what approach would work using a generic crontab solution, a
solution that does not assume it is the only tcsh instance?

[Whenever the cronjob executes it is almost guaranteed that my account
will have one or more active tcsh login shells on the system - hence
when those sessions terminate the 8M .history will reappear again]

I'm afraid in this scenario (ie, my account always has at least one
active login session), there is only the manual solution.

Thanks,
-Bob
 Andover, MA



Relevant Pages