Ubuntu – Pg Dn key returns tilde (~)

keyboardterminalUbuntu

When I hit Page Down in terminal (I'm using Ubuntu 12.04), strangely I get the ~ (tilde) character. This is annoying especially when I searched my command line history and decided to go to the bottom to get my prompt back.

Say, I have 1,351 lines of history. Found what I was looking for in line 869. I could just backspace or Ctrl + C, but I'd much prefer to go to the bottom.

Anyone knows how to change this behavior?

Best Answer

Try Shift+Page down or something similar (eg. Ctrl+Alt+Page down).

Page down sends the page down key to the program running inside the terminal. If that's your shell (bash/zsh/whatever), it probably doesn't accept the key combination, and ends up trying to parse the encoded key, which contains ~.

It's more likely you were scrolling in your terminal program itself, using the scroll bar or something similar, so you want a key that your terminal program accepts directly. You didn't specify which program you're using, but Shift+Page down is common. You can also try different modifier key combinations; your terminal's key binding setup might also have more information.

Related Question