Terminal: navigate to beginning and ending of line

Sometimes it's handy to go to the beginning of the line, maybe you want to add a forgotten sudo? Or to move to the end of the line to add some arguments?
To navigate to the beginning of the current line, use: CTRL+a.
To navigate to the end of the current line: CTRL+e.
Hint: the shortcuts work on most of the applications inside the terminal, like Vim, Emacs and others.