In my shell (zsh) or in python, I can go backward through command history by pressing PageDown, and I can go forward by pressing PageUp
zsh
python