You probably already know that Cx o will bring you to the next window. You can expand this to go to any arbitrary window with Cu <windowoffset> Cx o .
So, you can use Cu 2 Cx o to switch to the second window before your current one.
This wraps around the window list (so in your case of 5 windows you can do Cu 4 cx o to go back.
You can also use negative numbers to go back.
Finally, this requires a bit more customization, but Thomas's suggestion to use WindMove is very useful. It was not configured by default for me for any useful key binding. I add the following snippet to my (mac) .emacs file, whch allows me to switch windows using the control arrow (you need to reload .emacs by running or through "Mx load-file")
(global-set-key (kbd "M-[ 5 d") 'windmove-left) (global-set-key (kbd "M-[ 5 c") 'windmove-right) (global-set-key (kbd "M-[ 5 a") 'windmove-up) (global-set-key (kbd "M-[ 5 b") 'windmove-down)
Michael chinen
source share