LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 03-02-2005, 02:05 PM   #1
geomatt
Member
 
Registered: Mar 2004
Location: PA
Distribution: Slackware 12.0
Posts: 315

Rep: Reputation: 30
The case of the disappearing bash history


Hi,
I am having an issue with my bash history. Every once in a while the history file gets overwritten with a blank new file and then starts collecting commands again. I am really not sure what I am doing to cause this to happen since it always surprises me when I suddenly can't cycle back through recent commands.

here are the relevant environmental variables as revealed by set:
Code:
HISTFILE=/home/george/.bash_history
HISTFILESIZE=500
HISTSIZE=500                                                <---is this needed?
...
SHELLOPTS=bracexpands:emacs:hasall:histexpand:history:interactive-comments:monitor
All of these are slackware defaults.


If anybody has any suggestions on what I can do to prevent this from recurring, I'd appreciate it. I've been wading through the bash man page looking for clues, but haven't yet found anythying too promising.


Thanks,
geomatt


BTW: running slack 10, kernel 2.6.10
 
Old 03-02-2005, 02:49 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,950
Blog Entries: 11

Rep: Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860
All you need to do is accidentally paste 500
new-lines into an xterm and bash-history is gone ;)

cat-ing a large binary can stuff it up ...


Cheers,
Tink
 
Old 03-02-2005, 03:14 PM   #3
geomatt
Member
 
Registered: Mar 2004
Location: PA
Distribution: Slackware 12.0
Posts: 315

Original Poster
Rep: Reputation: 30
Oh that it explains it!
I did do a "cat /var/log/acpi" and watched hundreds of lines whiz by so I could see the last couple of lines. Is there any way to avoid that happening?

-geomatt
 
Old 03-02-2005, 03:28 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,950
Blog Entries: 11

Rep: Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860
That shouldn't have that effect ... plain ASCII files won't do
that... but to see only the last few lines you should be using
tail, e.g. tail -n 10 /var/log/acpid to see the last 10 lines.


Cheers,
Tink
 
Old 03-02-2005, 03:37 PM   #5
geomatt
Member
 
Registered: Mar 2004
Location: PA
Distribution: Slackware 12.0
Posts: 315

Original Poster
Rep: Reputation: 30
hmm, I wonder what it was then. Only binaries will wipe out the bash history? Maybe I leaned on the return key then.

And thanks for the tip on getting only the last few lines!

-geomatt
 
Old 03-02-2005, 04:08 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,950
Blog Entries: 11

Rep: Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860
As I said ... binaries may have that effect, as may a highlight
in X (an "empty" document, heaps of CRs) and middle-click
in the xterm ... to avoid that you could add the
export HISTCONTROL=ignoredups
to your bashrc ...

The three history-related settings you DO have you
don't need in the first place, they're all just the defaults.



Cheers,
Tink
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
NOT escaping bash history ivanatora Linux - General 3 06-07-2005 01:17 PM
history not working in bash subu_s AIX 2 12-29-2004 12:49 PM
bash history slowly Linux - General 2 11-12-2004 11:35 AM
F8 for command history in bash titanandrews Linux - General 7 10-15-2004 03:25 PM
Bash History ukndoit Linux - Security 2 10-16-2003 09:02 AM


All times are GMT -5. The time now is 02:40 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration