Is there a way that I can remove repeated commands from bash history?

For example: I run the mv command once, then I run the ls command n times.

I have to press the up arrow n times to get the mv command again.

How can I keep just one ls command instead of n.

link|improve this question
feedback

1 Answer

up vote 10 down vote accepted

Setting the following environment variable:

HISTCONTROL="ignoredups"

Will prevent duplicate commands from being logged.

link|improve this answer
Thank you ,its worked for me. – user31985 Jan 17 '10 at 15:28
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.