Enable Autosuggestions in Your Shell

Explains the difference between shell autosuggestions and autocompletion, and shows how to enable suggestions in Bash, Zsh, and Fish.

Jun 10, 2024 · 1 min read · 145 Words · -Views -Comments · Programming
Linux 🇨🇳 阅读中文版
Read with AI

Choose an AI assistant

ChatGPT Open in a new tab with the article link and prompt
Claude Copy the prompt, then open Claude

Open Claude
Trouble reading the article?

If the prompt is missing, copy the full prompt below into your AI assistant. If the AI cannot read the article, paste the visible passage you want to discuss and add your question.

Some terminals show ghosted command suggestions as you type. Press → to accept them instantly—that feature is called autosuggestion.

Autosuggestion vs. Autocompletion

They’re different concepts.

  1. Autosuggestion leverages history or heuristics to display a full command after the cursor. Press one key to accept it.

    https://static.1991421.cn/2024/2024-06-10-131006.jpeg

  2. Autocompletion uses command metadata to offer options when you press a trigger key (usually Tab). It doesn’t fill the entire command—just the current argument—and often produces multiple candidates.

    https://static.1991421.cn/2024/2024-06-10-223521.jpeg

Both can coexist without conflict.

Enabling Autosuggestions

Each shell handles it differently.

Bash

No official community solution yet. Some terminals, like Warp, implement their own.

Zsh

Install via Oh My Zsh:

# Install Oh My Zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

# Enable the zsh-autosuggestions plugin
plugins=(
  ...
  zsh-autosuggestions
)

Fish

Fish ships with autosuggestions enabled—no extra configuration required.

Final Thoughts

Turn on autosuggestions. Many commands repeat; accepting suggestions saves time and effort.

Authors
Developer, digital product enthusiast, tinkerer, sharer, open source lover