How to hide terminal commands from history file

Source

I keep all of terminal settings in a .profile file. I added the following line to the bottom of the file

export HISTCONTROL=ignorespace

So now it looks like this:

Now if I add a space before typing a command, the command is excluded from the history file.