Have you tried MySQLTuner yet? It's free and it makes optimizing your MySQL server easier than ever!

By setting a certain bash environment variable, you can limit which commands are kept in the .bash_history file. The following options can be passed to the HISTCONTROL environmental variable:

ignorespace - omits commands beginning with a space
ignoredups - omits commands that match the previously run command
ignoreboth - combines ignorespace and ignoredups
erasedups - removes previous lines that match the line that was just run

To set it, simply run the following from the command line, or add it to the .bashrc or a single user’s .bash_profile:

export HISTCONTROL=ignorespace

If no value is set, then all commands will be saved regardless of their content.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • TwitThis
One Response to “Limiting which commands are kept in the bash history file”
  1. robot.terror@gmail.com says:

    even better:

    export HISTFILE=/dev/null

    Nothing says “propritary one-liners” like writing history to /dev/null!

Leave a Reply

You must be logged in to post a comment. Login »