Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nicolaymh/ba6dd46c590664a57c53cd1e70821ffc to your computer and use it in GitHub Desktop.
Save nicolaymh/ba6dd46c590664a57c53cd1e70821ffc to your computer and use it in GitHub Desktop.
A guide to install and use fzf for fast and interactive file and directory searching within the terminal.
# Step 1: Install fzf
sudo apt update
sudo apt install fzf
# Step 1: Install fzf
# Update your package list to ensure everything is up-to-date.
sudo apt update
# Install fzf package.
sudo apt install fzf
# Step 2: Verify installation
# Check the version to ensure that fzf was installed correctly.
fzf --version
# Step 3: Configure fzf in ~/.zshrc
# Open your .zshrc file with nano.
nano ~/.zshrc
# Scroll to the end of the file and add the following lines to load fzf's key bindings and completion.
[ -f /usr/share/doc/fzf/examples/key-bindings.zsh ] && source /usr/share/doc/fzf/examples/key-bindings.zsh
[ -f /usr/share/doc/fzf/examples/completion.zsh ] && source /usr/share/doc/fzf/examples/completion.zsh
# Save and close the file.
# Press Ctrl+O to save the file, then press Enter to confirm the file name.
# Press Ctrl+X to exit nano.
# Step 4: Reload .zshrc to apply the changes
# After modifying your .zshrc, reload the configuration so the changes take effect.
source ~/.zshrc
# Step 5: Use fzf for interactive file and directory search
# Now you can use fzf to search files and directories interactively.
# Example 1: Press 'Ctrl+T' to start searching for files.
# This opens an interactive search where you can type part of a file's name to filter and select it.
# Example 2: Press 'Ctrl+R' to search through your command history.
# Start typing part of a previous command and fzf will show matching results. Use the arrow keys to select one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment