LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-06-2010, 05:30 PM   #1
mattseanbachman
Member
 
Registered: Feb 2010
Posts: 40

Rep: Reputation: 15
.bash_history file is not current to output of history


Having an issue with my .bash_history file. It's certainly not a crisis, but it's been bothering me ever since I noticed it.

Say I look at my bash history by just getting onto a terminal and doing
Code:
history
This is totally different from what comes up when I do a
Code:
vim /home/toor/.bash_history

I remember typing both sets of commands, but the output from the command 'history' is much more current than is the file that it's presumably reading from to present it to me via my terminal!

So what gives? My OS is Linux Mint; as far as I can recall, the two files are synced on Fedora, but it's been a while since I've used that.

If anyone's dealt with, noticed this problem I'd appreciate any tips for getting them synchronized with one another.

-Matt
 
Old 03-06-2010, 06:10 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 18,349

Rep: Reputation: 3910Reputation: 3910Reputation: 3910Reputation: 3910Reputation: 3910Reputation: 3910Reputation: 3910Reputation: 3910Reputation: 3910Reputation: 3910Reputation: 3910
Quote:
Originally Posted by mattseanbachman View Post
Having an issue with my .bash_history file. It's certainly not a crisis, but it's been bothering me ever since I noticed it.

Say I look at my bash history by just getting onto a terminal and doing
Code:
history
This is totally different from what comes up when I do a
Code:
vim /home/toor/.bash_history

I remember typing both sets of commands, but the output from the command 'history' is much more current than is the file that it's presumably reading from to present it to me via my terminal!

So what gives? My OS is Linux Mint; as far as I can recall, the two files are synced on Fedora, but it's been a while since I've used that.

If anyone's dealt with, noticed this problem I'd appreciate any tips for getting them synchronized with one another.

-Matt
Exit your current shell, and the history file gets updated.
 
Old 03-06-2010, 10:33 PM   #3
ArfaSmif
Member
 
Registered: Oct 2008
Location: Brisbane Australia
Distribution: Always back to Fedora
Posts: 263

Rep: Reputation: 52
There are several parameters which affect your bash history. Have a look at these (and there are more too):-

HISTCONTROL=ignorespace
HISTFILE=/home/username/.bash_history
HISTFILESIZE=2000
HISTSIZE=2000

and do a "man bash" to see what each parameter refers to.
 
Old 03-06-2010, 11:31 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
On top of the two previous suggestions you may find
Code:
shopt -s histappend
export PROMPT_COMMAND='history -a'
added to your ~/.bashrc rather useful ...


Cheers,
Tink
 
Old 03-07-2010, 02:25 AM   #5
mattseanbachman
Member
 
Registered: Feb 2010
Posts: 40

Original Poster
Rep: Reputation: 15
Sincere thanks for the help!
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to clear the output of history command jeff80 Linux - Newbie 10 08-02-2009 03:04 PM
tcsh: can you save the history from multiple shells to one history file? BrianK General 2 04-23-2009 06:19 AM
Any way to grep Konsole History (commands + output) ? pujan Linux - Newbie 1 02-03-2009 01:54 PM
Why doesn't removing .bash_history get rid of history? dggoldst Zenwalk 1 04-05-2007 05:20 AM
Write history to .bash_history on reboot Kvetch Linux - Software 2 03-14-2007 09:43 PM


All times are GMT -5. The time now is 06:31 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration