BASH HISTORY

CHANGE DISPLAY FORMAT
Edit your ~/.bashrc file...

Terminal:~$ HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S "
 * 1) history format

DELETE AN ENTRY FROM HISTORY
Find the number next to the one you want to delete and run...

Terminal:~$ history -d $num

LOG COMMANDS EXECUTED BY ALL THE USERS
Edit the /etc/bashrc file and add this line...

Terminal:~$ sudo nano /etc/bashrc PROMPT_COMMAND='history -a >(logger -t "$USER[$PWD] $SSH_CONNECTION")' or readonly PROMPT_COMMAND='history -a >(logger -t "$USER[$PWD] $SSH_CONNECTION")' or readonly PROMPT_COMMAND='history -a >(logger -p local2.info -t "$USER[$PWD] $SSH_CONNECTION")'

Thanks to Ashok Linux Tips

PREVENT COMMAND FROM BEING RECORDED IN HISTORY
If you want to run a command without saving it in history, prepend it with an extra space.

prompt$ echo saved prompt$ echo not saved \ > #    ^ extra space

For this to work you need either ignorespace or ignoreboth in HISTCONTROL. For example, run...

HISTCONTROL=ignorespace

To make this setting persistent, put it in your .bashrc.