Last active
October 12, 2025 15:24
-
-
Save alirezapla/81ed6343768b0ef3bea83f5460dcaddc to your computer and use it in GitHub Desktop.
fzf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fzf --preview="head -n 20 {}" | |
| find . -type f -name "*RequestInfo.java" | fzf --preview="head -n 30 {}" | |
| # same | |
| fzf --query="RequestInfo.java$" --preview="head -n 30 {}" | |
| # almost same | |
| fzf --filter="RequestInfo.java$" --preview="head -n 25 {}" | |
| # Case insensitive regex | |
| fzf --filter="(?i)RequestInfo.java$" --preview="head -n 20 {}" | |
| # Much faster than grep for interactive use | |
| fzf < large_file_list.txt | |
| # Kill processes | |
| kill $(ps aux | fzf | awk '{print $2}') | |
| # Combined file and directory search | |
| fzf --preview=' | |
| if [ -d {} ]; then | |
| tree -C {} | head -50 | |
| else | |
| bat --color=always {} 2>/dev/null || head -100 {} | |
| fi' | |
| fzf --preview="git log --oneline {} | head -10" # Git history | |
| fzf --preview="file {}" # File type info | |
| fzf --preview="stat {}" # File statistics | |
| fzf --preview="exiftool {} | head -20" # Image metadata | |
| # With process details | |
| ps aux | fzf --preview="echo 'PID: {2}' && echo 'Command: {11}'" | |
| # Search only specific file types | |
| fd -t f -e java -e py | fzf # Only Java and Python files | |
| # Ignore node_modules, .git, etc. | |
| fd --hidden --no-ignore | fzf # Include hidden files but respect .gitignore | |
| # Add to .bashrc/.zshrc | |
| export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git' | |
| export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" | |
| export FZF_ALT_C_COMMAND="fd --type d --hidden --follow --exclude .git" | |
| # Now fzf is integrated into your shell workflow! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment