3

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.

11

Setting the following environment variable:

HISTCONTROL="ignoredups"

Will prevent duplicate commands from being logged.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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