How to stop bash replacing commands in history with asterisks ? (‘*’)

I have some commands replaced with * in the bash history, e.g.

1094  apt-get update
1096  dpkg -i /var/cache/apt/archives/libssl1.0.0_1.0.0h-1_amd64.deb

How to prevent this?

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

As explained in the Bash manual, history lines prefixed with a * have been modified. This happens when you navigate to a command (e.g. by using the Up key), edit it and then navigate away from it without hitting Enter. So a history line like this:


is usually the result of navigating to a command in history, backspacing and navigating away from it. Knowing this, you can easily prevent such lines appearing in your Bash history.

BTW, you can revert modified commands to their unedited state by navigating to them and hitting Ctrl + _ repeatedly.

Solution 2

Looks like mark-modified-lines is enabled in your shell. Try disabling it in ~/.inputrc:

set mark-modified-lines Off

Details in man bash.

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply