A: Yes, you can do so in bash shell using the below method
In bash there is a variable HISTCONTROL which can be used to achieve our task. By default it contains a value of "ignoredups" as per which history command avoids keeping duplicate command records.
Let us change it to something else
# export HISTCONTROL=ignorespace
Let us verify if the value is changed
# echo $HISTCONTROL
ignorespace
Now as per this any command you run starting with a space will not be monitored or stored in history or and file defined under HISTFILE which by default is ~/.bash_history.
Let us try to run some commands with a space
Output of history before running command
# history | tail -5
412 echo $HISTCONTROL
413 cd /etc/httpd/conf
414 vi httpd.conf
415 /etc/init.d/httpd status
416 history | tail -5
# date
Verify your results
# history | tail -5
413 cd /etc/httpd/conf
414 vi httpd.conf
415 /etc/init.d/httpd status
416 history | tail -5
417 history | tail -5
Making the changes permanent
Now the variable change made is temporary and terminal based which means next time you login the HISTCONTROL variable will return to its default value.
To make it permanent follow the below link
How to set environment (PATH) variable permanently in Linux
Related Articles
View the history of commands along with time
Long list the files on the basis of time