shortcutsguide

Autocomplete in Terminal (Tab)

Press Tab to autocomplete the command, file name or path you are typing. Press it twice to list all matches. Same key in bash and zsh on macOS Terminal, Linux and Windows WSL / Git Bash.

ActionMacWindows
Autocomplete command / path Tab Tab
List all matches Tab Tab Tab Tab
Reverse-search history Ctrl+R Ctrl+R
Clear the screen Ctrl+L Ctrl+L

Let the shell finish your typing

Start typing a command, file name or directory and press Tab. If there is a single match, the shell completes it for you. This works in bash and zsh on macOS Terminal, Linux and Windows WSL / Git Bash.

Press Tab twice to see options

If several names match, nothing completes on the first Tab. Press Tab again to print the full list of candidates, then type one more letter and press Tab to narrow it down.

zsh gives you a selectable menu

In zsh (the default shell on modern macOS), pressing Tab repeatedly cycles through a highlighted menu of matches — press Tab to move forward and Shift+Tab to move back. Bash just lists them. If completion seems missing in bash, install the bash-completion package.

FAQ

How do I autocomplete a command in the terminal?

Type the first few letters and press Tab. The shell completes the command, file name or path when there is a single match. Same key on Mac, Linux and WSL.

Why does nothing happen when I press Tab?

There is more than one match, so the shell waits. Press Tab a second time to list all candidates, then type another letter to narrow the choice.

How is Tab completion different in zsh and bash?

zsh shows a selectable menu you cycle with Tab and Shift+Tab. bash just prints the list. For richer bash completion install the bash-completion package.

Can Tab complete file paths too?

Yes. Tab completes commands, file names, directory paths and often command options, depending on the completion scripts installed.