There is an annoying problem with Ubuntu. Using the command line editor nano, the backspace key acts sometimes as the delete key (deleting the first character on the right and not on the left).
You can fix this by adding the following line to your /etc/nanorc file:
set rebinddelete