Append bash history in real-time and change output to show date and time of the command execution

Bash history can be very useful to re-trace steps performed on the system, but one of the issues is that commands are not logged in real-time but after ending a session. Also history output does not include date and time which is really useful for debugging.

In order to solve this you will need to append 3 lines to your ~/.bashrc file:

shopt -s histappend
PROMPT_COMMAND="history -a;$PROMPT_COMMAND"
export HISTTIMEFORMAT='%F %T '

In order for this to become active you need either to log out and log back in our execute:

source ~/.bashrc

After this all your commands will be logged in real-time and output of history command will have date & time information in following format:

YYYY-MM-DD HH:MM:SS history

Midnight commander mc not showing in default colors in GNU screen

If you are using GNU screen and you notice that while MC is showing in default blue color for root but not for the user the easy fix would be to try this:

TERMCAP='' /usr/bin/mc --skin=default

If this works for you and mc is showing in color then you can setup an alias in your .bashrc like:

alias mc='TERMCAP="" /usr/bin/mc --skin=default'

do the reload of .bashrc with:

source .bashrc

Then the next time you run mc from with your user it should be displayed in default color instead of black and white.