By default, TAB runs the ‘complete’ function whereas ‘\C-n’ runs ‘menu-complete’ and ‘\C-p’ runs ‘menu-complete-backward’.
So, let’s say you have .bash_history, .bash_logout and .bashrc in your current directory. When you type “ls .bash<TAB>
“, this will be shown:
$ ls .bash<TAB>
.bash_history .bash_logout .bashrc
When you hit CTRL+N (next) now, the auto completion will replace ‘.bash’ with the first match from the list of possible completions, i.e. ‘.bash_history’. Repeated CTRL+N steps through the list of possible completions, inserting each match in turn.
CTRL+P (previous) moves backward through the list and matches in reverse sequence.