Why do some lines in the SHELL' history end with "*"

This is the first in a series of posts featuring Protips, tips, tricks, hacks, and secrets provided by Our Team 🙊 — We want to share our top tips for the growing and thriving Linux community out there. Because sometimes you need a little help...

Why do some lines in the SHELL' history end  with "*"

In Linux, there is a very useful command to show you all of the last commands that have been recently used.

The command is simply called, history but can also be accessed by looking at your .zsh_history or .bash_history in your home directory.

By default, the history command will show you the last five hundred (500) commands you have entered. Pretty cool command, isn't it?

As your see below some lines contain an * asterisk at their end, but why?

$ history -E -100

...
..
10059* 11.11.2021 14:17  sudo rm -r whyu57KF.jpg cWynotfcf576.jpg
10060* 11.11.2021 14:17  ls
10061* 11.11.2021 14:17  sudo rm -r 334JOcWhgjd.jpg rgyhjb_o.jpg
10064* 11.11.2021 14:22  ls
10065* 11.11.2021 14:44  cd
10066* 11.11.2021 14:44  clear
10068  11.11.2021 14:45  sudo cscli decisions list | grep ban | wc -l
10070* 11.11.2021 14:45  sudo apt update
10071* 11.11.2021 14:46  sudo apt list --upgradable -a
10072* 11.11.2021 14:46  sudo apt -y upgrade
10073  11.11.2021 14:46  sudo rkhunter --propupd
10074* 11.11.2021 15:37  sudo apt update
10077* 11.11.2021 16:03  pwd
10079  11.11.2021 16:03  sudo apt update
10081* 11.11.2021 16:17  cd
10082* 11.11.2021 16:17  ls -a
10083* 11.11.2021 16:27  clear
...
..


* Asterisks indicate that the commands were run from a different session; simple is that.

This may be verified by opening two terminal windows, issuing a series of commands, and examining the history in both.

* Asterisk will only display instructions executed by the other window.

We hope you have found this post as useful and informative as we do.
See you in our next post and don't forget — Knowledge sharing contributes to a bright and better tomorrow.
Please, don't break the chain!