#!/bin/bash # Add cheat sheets for fd-find, ripgrep, zsh, fish CHEAT_DIR="/opt/cheatsheets/personal" mkdir -p "$CHEAT_DIR" # fd-find cheat sheet cat > "$CHEAT_DIR/fd" << 'EOF' # fd (fdfind) - Fast and user-friendly alternative to find # Find files by name fdfind pattern # Find in specific directory fdfind pattern /path/to/search # Find only files (no directories) fdfind -t f pattern # Find only directories fdfind -t d pattern # Case-insensitive search fdfind -i PDF # Include hidden and ignored files fdfind -H pattern # Execute command on results fdfind pattern -x rm # Find and show absolute paths fdfind -a pattern # Find files modified in last 24 hours fdfind -t f --changed-within 24h # Find PDF files in current directory fdfind -e pdf # Exclude directories from search fdfind pattern -E node_modules -E vendor EOF # ripgrep cheat sheet cat > "$CHEAT_DIR/rg" << 'EOF' # ripgrep (rg) - Fast recursive grep alternative # Basic search rg pattern # Case-insensitive search rg -i pattern # Search specific file types rg -t py pattern rg -t js pattern # Search in specific files rg pattern -g '*.pdf' # Show context (3 lines before/after) rg -C 3 pattern # Show only filenames with matches rg -l pattern # Count matches per file rg -c pattern # Search for exact word rg -w word # Search hidden files rg --hidden pattern # Search compressed files rg -z pattern file.gz # Find URLs in files rg 'https?://[^\s]+' # Find suspicious JavaScript in PDFs rg -i 'javascript|openaction' -g '*.pdf' # Search with file types excluded rg pattern --type-not python # Multiline search rg -U 'pattern1.*pattern2' EOF # ripgrep alias cp "$CHEAT_DIR/rg" "$CHEAT_DIR/ripgrep" # zsh cheat sheet cat > "$CHEAT_DIR/zsh" << 'EOF' # zsh - Z Shell with powerful features # Start zsh zsh # Set zsh as default shell chsh -s $(which zsh) # Autocompletion # Type command and press TAB # History search # Type start of command and press UP arrow # Directory stack dirs -v # Show directory stack pushd /path # Push directory and cd popd # Pop and return to previous # Glob patterns ls **/*.pdf # Recursive glob ls *.pdf~*.bak # Exclude pattern # Aliases (already configured in container) ll # ls -lah fd # fdfind analyse # fhelp ? # fhelp # History commands history # Show all history history 10 # Show last 10 !$ # Last argument of previous command !! # Repeat last command EOF # fish cheat sheet cat > "$CHEAT_DIR/fish" << 'EOF' # fish - Friendly Interactive Shell # Start fish fish # Set fish as default shell chsh -s $(which fish) # Autocompletion # Type command and press TAB (shows suggestions automatically) # History search # Type start of command and see suggestions # Press RIGHT arrow to accept # Command abbreviations abbr --add gco git checkout abbr --list abbr --erase gco # Functions (instead of aliases) function ll ls -lah $argv end funcsave ll # Save function permanently # Environment variables set -x PATH /new/path $PATH # Export set -e VARIABLE # Erase # Configuration fish_config # Open web-based configuration # Plugins (fisher) # curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher EOF echo "✅ Added cheat sheets for fd, ripgrep, zsh, fish"