The terminal prints ^M instead of a new line!

It is probably because some program didn't exit properly. 

Thankfully, there is a program called stty that can fix this. 

Here is how to reset all modes to reasonable values for the current terminal:

stty sane

You can see all settings for the curent terminal like so:

stty -a