Libervis Network - For a Free WorldLibervis Projects | Nuxified Projects
Welcome guest. Register | Login | Show what's new
Inatux.com

Use HISTIGNORE in bash

Don't you find it annoying when you have been using the same command in bash a few times in a row, and then you scroll through the history to a previous command only having to go through many duplicates of the command you just used.

For this use bash's HISTIGNORE variable, set in in your ~/.bashrc file.
HISTIGNORE="&"

Will mean you will not have duplicates in your bash history, but you can use other varables too, say you don't want the commands beggining with c to be put in the history.

An example of this together with not having duplicates:
HISTIGNORE="c*:&"

libervisco's picture

Great tip! I didn't know

Great tip! I didn't know about that. I do sometimes use one command many times (usually when testing something) and then when I go through history it repeats the same one many times..

I'll try this.

Thanks Smiling

waylandbill's picture

Good find!

I didn't know that variable even existed.

tbuitenh's picture

Some programs might

Some programs might allow/require a password on the commandline. Put those in histignore too so your password can't be found by reading your history file.

[link removed]

Don't you find it annoying when you have been using the same command in bash a few times in a row, and then you scroll through the history to a previous command only having to go through many duplicates of the command you just used.

[link removed]

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd><br><p><img><br><b><i>
  • You may quote other posts using [quote] tags.
  • You can use BBCode tags in the text. URLs will automatically be converted to links.
  • Textual smileys will be replaced with graphical ones.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Lines and paragraphs break automatically.
  • Glossary terms will be automatically marked with links to their descriptions. If there are certain phrases or sections of text that should be excluded from glossary marking and linking, use the special markup, [no-glossary] ... [/no-glossary]. Additionally, these HTML elements will not be scanned: a, abbr, acronym, code, pre.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
12 + 2 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

We have 7827 members who wrote 2145 articles and 12193 comments. Welcome to our newest member, SharmelWaicky!

Who's online

There are currently 0 users and 12 guests online.
Nuxified RSS feed