Why do some lines in the SHELL' history end with "*"
In Linux, there’s a handy command to display all recently used commands: history. You can also view past commands by checking the .bash_history
or .zsh_history
file in your home directory.
By default, the history
command displays the last 500 commands you've entered. Pretty useful, 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
...
..
The *
(asterisk) indicates commands run from a different session—simple as that. You can verify this by opening two terminal windows, running a series of commands in each, and then checking the history in both. The asterisk will only appear next to commands executed in the other window.
We hope you found this post as useful and informative as we did.
See you in our next post, and remember — sharing knowledge paves the way to a brighter tomorrow.
Please, don't break the chain!