0

Suddenly my bash history behavior changed. When I'm either calling an old command using !num (where num is the number of the commmand as seen in history) or displaying the command (without running it) using !num:p, the command disappears from my history.

This can be seen here:

[f@meshtretch 19.8G  ~ ] $ history 
    1  su
    2  exit
    3  whoami
    4  uptime 
    5  uname -a
    6  history 

[f@meshtretch 19.8G  ~ ] $ !3:p
whoami

[f@meshtretch 19.8G  ~ ] $ history 
    1  su
    2  exit
    3  uptime 
    4  uname -a
    5  whoami
    6  history 

I'm expecting the "whoami" command to still show at number 3 (and not just at 5) but it disappeared. It's the same behavior for all the users on my system.

What is going on?

2

It turns out I did the following in my .bashrc:

HISTCONTROL=ignoredups:erasedups

when I meant to do:

HISTCONTROL=ignoredups

But somehow I forgot I made the change because I hadn't used the ! an !...:p functionalities in a while. Then I copied the .bashrc to my various users account.

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.