Ubuntu – How to find the command history if a user used a space before the command

bash

Do we have any way to find out the command history if the user uses space before any command in the bash, because if user uses space before any command it won't show in history?

Best Answer

There is no way to find out now. You probably have a setting in ~/.bashrc that intentionally hides all commands prepending with a space from history. To change this behaviour in the future, you can edit ~/.bashrc. Look for this line

HISTCONTROL=ignoredups:ignorespace

and change it to

HISTCONTROL=ignoredups