Zsh under Ubuntu has a strange behaviour. When you have typed some commands and use up arrow key to look back, the cursor is always at the beginning of the line. This can be solved very easily.
Since Ubuntu inherits package from Debian, this bug is from Debian also. Edit your global zshrc file in Ubuntu here:
Remove everything between
#ncurses fogyatekos and
Log out and log back in, when you press the up arrow key to do history lookup, the cursor will be placed at the end of line.
Other Linux distribution and Unix operating systems do not have this problem.
If you are using oh-my-zsh, please disable vi-mode.