 |
Compare
providers from the web hosting
categories above - Click
Here |
Recent
Articles |
CNN Shows The Linus Interview
The Linux operating system has reshaped the technology industry greatly over the
past decade, but creator Linus Torvalds still comes across as just another techie
who enjoys working on code.
Selinux
on FC5
Selinux can be confusing, but it's ordinary and default configuration is actually
pretty simple. We'll examine it on Fedora Core 5.
Mount
--bind
Most Linux and Unix file systems don't allow hard links to directories (except
for the . and .. entries that mkdir creates itself).
Time to Fix the Bugs?
Almost two years ago I wondered about the negative aspects of companies like IBM
and HP trying to control Linux by hiring
top Linux developers.
GNOME
Released With New Search
Version 2.14 of GNOME's desktop for Linux or UNIX systems contains a new integration
of a desktop search bar that can search the local machine or several search engines
online.
|
|
|
05.24.06 Bash HISTCONTROL
By
A.P. Lawrence I happened to come across Linux Tips: take control of your bash_history.
This explains that setting "export HISTCONTROL=ignoreboth" causes Bash not to store duplicate commands in history. For example, if you are checking "ps" waiting for some process to end:
ps -e | grep foo
and keep pressing up arrow every few seconds to repeat it, you'll end up with a long list of those in your history if this isn't set. If it is set, you get only the last.
Actually there's much more to this than that little post exlained.
First, there's actually several values HISTCONTROL can take. On newer bash, it can be set to "ignorespace", "ignoredups", "ignoreboth" or "erasedups". Bash 2.05 doesn't have "erasedups".
If you want manual control over history, set "ignorespace". Then remember to use a space to precede any command you don't want to remember in history.
Compare
providers from web hosting categories
Click
Here |
|
Bash ignores leading spaces, so " ls" is as good as "ls", but with "ignorespace" set, " ls" won't be saved.
The "ignoredups" setting ignores repeated lines. Typing "ls" twenty times in a row only ends up with one of them in history.
However, typing "ls" and then "ps" and then "ls" again will store "ls" and "ps" every time - unless you have bash 3 and set "erasedups". If that's set, no duplicates get entered in bash history at all.
You can also control bash history with HISTIGNORE. For example, if I "declare -x HISTIGNORE=ls:ps", neither "ls" or "ps" will appear in my history.
To ignore all two character commands, use "declare -x HISTIGNORE='??'".
I don't like extra commands cluttering up my history file, so I use "ignoreboth".
When available, I use "erasedups", but if you are using history as a record of commands rather than just for the convenience of repetition, you don't want that.
*Originally published at APLawrence.com
About the Author:
A.P. Lawrence provides SCO Unix and Linux consulting services http://www.pcunix.com
|