Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 10 down vote accepted

Setting the following environment variable:

HISTCONTROL="ignoredups"

Will prevent duplicate commands from being logged.

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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