Amit Agarwal

Linux and Photography Blog
e-mail
information

I have been looking to do this for sometime. The bash history is per
session basis and the last session to quit overwrites the bash_history
file and thus all other terminals started between the time last terminal
lasted does not get to write the commands in the history file. Secondly
the history gets cluttered with lot of duplicate entries and entries
with ls and cd commands. So finally I added these to the bashrc file:

#Ignore these commands for inclusion in the history file
export HISTIGNORE=”history *:cd *:df *:exit:fg:bg:file
*:ll:ls:mc:top:clear:$HISTIGNORE”
export HISTIGNORE=”&:ls:[bf]g:exit:cd:history:*.bash_history”
#append to the histofy file
shopt -s histappend
#Write the history immediately after the command execution
PROMPT_COMMAND=`history -a`
HISTCONTROL=ignoreboth
#Erase duplicates from history
export HISTCONTROL=erasedups

Enter Your Mail Address

Bash histoy – common history in different terminals Bash histoy – common history in different terminals

Facebook comments:

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment



IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)

What is 7 + 7 ?
Please leave these two fields as-is:
language
rss
store

© 2010 Amit Agarwal | Entries (RSS) and Comments (RSS) | Valid CSS 2.1 Valid XHTML 1.0 Transitional

Powered by Wordpress 3.0.1, design by Abel, handcrafted by Abel County Laboratories, based on Wsg Standards Wsg Standards

Switch to our mobile site

Page optimized by WP Minify WordPress Plugin