I'm using Ubuntu 12.04.2, and my keyboard doesn't work normally in terminal. When I press the arrow keys, the characters "a", "b", "c", or "d" appear. The Backspace key is also not working.
By default, Ubuntu will install vim-tiny, a bare-bones version of vim. When you type vi in the terminal, it will start this minimal vim in vi compatible mode by default. From a normal vim user's standpoint, this is horrible, since vi compatible means backspace and all the normal vim behavior will behave in the original vi manner. so, install vim by typing the command :
sudo apt-get install vim
problem solved !! enjoy programming ;) :)