command stack in buffer

Andrew Kane googoleyes at gmail.com
Tue Jan 5 09:07:01 UTC 2010


On Tue, Jan 5, 2010 at 12:56 AM, vijay shanker <vijay.shad at gmail.com> wrote:
> Hi all,
> I hope many of you must be aware of this.
> When i use a terminal to execute my commands. Some times i need to execute
> same command multiple times. So, if i want to choose a previously executed
> command, It makes me very tired to choose from history of command.
> So , instead of choosing I prefer to go and write it again. But i was
> thinking if there existing any thing that can remove duplicates form
> the command history?
> Regards,
> Vijay Shanker Dubey
>
>

I can think of two things. First, bash offers tab-completion. If you
type the first few keystrokes of a command and hit tab, bash will
attempt to complete it for you. It takes some getting used to, but you
might find it easier than arrowing through your bash history.
Also, you could write a script that trims duplicates from your
~/.bash-history at shell startup-
Oh, actually you can edit ~/.bashrc and enable the option to ignore
duplicates in bash-history.
The relevant lines look like this:

# don't put duplicate lines in the history. See bash(1) for more options
# don't overwrite GNU Midnight Commander's setting of `ignorespace'.
HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoreboth

Good luck!




More information about the ubuntu-users mailing list