How to make the terminal auto-complete from the command history?

Solution 1:

You may use reverse-search. Just press ctrl+R and start typing your command, and then just press Enter.

Solution 2:

You may refer to auto suggestion.

And for zsh user, zsh-autosuggestions will be very helpful.