Published on

Unlimited and shared command line history on MacOS

Authors

For developers and system administrators using Zsh, having access to a shared command history across all terminal sessions can significantly boost productivity. Here's a quick guide on setting up your Zsh to not only share history but also to store an unlimited number of commands.

Step-by-Step Setup

  1. Open your Zsh configuration file: Edit your .zshrc file located in your home directory:

    nano ~/.zshrc
    
  2. Enable sharing and appending history: To make your history shared across sessions and updated in real-time, add these lines:

    setopt INC_APPEND_HISTORY
    setopt SHARE_HISTORY
    
  3. Remove history limits: Prevent Zsh from truncating your history by setting high values for history storage:

    HISTSIZE=999999999
    SAVEHIST=999999999
    
  4. Apply changes: Source your updated .zshrc or restart the terminal to make the settings effective:

    source ~/.zshrc
    

Further Reading

For more detailed information, you can consult the Zsh manual or specific entries about history management:

Implementing these settings will help ensure that your command history is always at your fingertips, regardless of the terminal session.