command stack in buffer
David Robert Lewis (ethnopunk)
ethnopunk at telkomsa.net
Tue Jan 5 10:56:12 UTC 2010
vijay shanker wrote:
> @ andrew
> Your suggestion does not seems to be working.
> my configuration in ~/.bashrc file
>
> # don't put duplicate lines in the history. See bash(1) for more options
> # don't overwrite GNU Midnight Commander's setting of `ignorespace'.
> export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups
> # ... or force ignoredups and ignorespace
> #export HISTCONTROL=ignoreboth
>
> @patton
>
> Yes; patton this is something I wanted to do. But if my history list
> is clean without any duplicates; i will end my search on this topic.
>
> :)
>
>
> Regards,
> Vijay Shanker Dubey
>
>
>
> On Tue, Jan 5, 2010 at 3:14 PM, Patton Echols <p.echols at comcast.net
> <mailto:p.echols at comcast.net>> wrote:
>
> On 01/05/2010 12:56 AM, vijay shanker 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.
>
> Do you mean that you don't want to scroll through the history to
> get to
> the command you want?
>
> What I use is [Ctrl]+r Then start typing the command. What the shell
> will do is search back through your commands to the most recent match.
> Sometimes you need to keep typing a few extra characters to get the
> right one.
>
> Example: I routinely ssh to two different computers. One is the
> server
> in my local network and the command is:
> $ssh pecho at 192.168.168.5 <mailto:pecho at 192.168.168.5>
> The other is to vpn and remote desktop to my office using this:
> ssh -C -p 13254 pecho at xxx.xxx.xxx.xxx -L 5901:localhost:5900
>
> if [Ctrl]+R "ssh" gives the first one, then I keep typing until I
> get to
> "ssh -" and the shell finds the right one.
>
> Try it!
> (BTW this is the bash shell which I believe is the standard in Ubuntu)
> >
> > 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
> >
>
>
Now that you raise the issue I am keen to try this solution from
http://blog.macromates.com/2008/working-with-history-in-bash/:
add to bashrc
export HISTCONTROL=erasedups
export HISTCONTROL=1000
shopt -s histappend
The first line will remove duplicates
Second line will increase history size
Third line ensures that when you exit a shell the history from that
session is appended
to ~/.bash_history
Haven't tried it yet, let me know if it works. :)
More information about the ubuntu-users
mailing list