fzf चीटशीट
0.57सब कुछ fuzzy find करें — files, history, processes, और बहुत कुछ
हिन्दी: 2026-03-29
fzf आपके terminal के लिए एक fuzzy finder है, और जब आप इसे इस्तेमाल करना शुरू करेंगे, तो सोचेंगे कि इसके बिना कैसे काम चलता था। कुछ भी इसमें pipe करें — file lists, git branches, process IDs, environment variables, शाब्दिक रूप से कोई भी line-based input — और fzf आपको एक instant, interactive, typo-माफ़ करने वाला search interface देता है। "400 lines के output में हर एक को घूर-घूरकर scroll करना" बदल जाता है "तीन characters type करो और पहुँच गए।"
fzf की खूबसूरती यह है कि यह एक Unix filter है। यह stdin से lines पढ़ता है, आपको एक (या कई) चुनने देता है, और आपकी selection stdout पर लिख देता है। बस इतना ही। यह सीधा contract मतलब है कि यह हर चीज़ में plug हो जाता है। इसे find, rg, git, ps, docker, या किसी भी text produce करने वाली चीज़ के साथ combine करें, और आपके पास free में एक interactive selector है। यह terminal workflows का duct tape है — बस यह वाकई में elegant है।
यह cheatsheet उन patterns पर focus करती है जो आप लगातार इस्तेमाल करेंगे: core commands, shell integrations जो आपके filesystem navigate करने का तरीका बदल देंगे, preview window जो selections को luxurious बना देता है, और real-world recipes जो fzf को "अच्छा toy" से "ज़रूरी infrastructure" में बदल देती हैं। अगर यहाँ सिर्फ तीन चीज़ें सीखनी हैं, तो वे हैं Ctrl-R, Ctrl-T, और --preview flag। बाकी सब bonus है।
बुनियादी उपयोग
fundamentals। ज़्यादातर लोग यहाँ से शुरू करते हैं और कभी realize नहीं करते कि rabbit hole कितना गहरा है।
Search Syntax
fzf की search language छोटी है लेकिन surprisingly powerful। आप इन tokens को एक ही query में combine कर सकते हैं।
fzf के अंदर Key Bindings
fzf खुलने के बाद, ये keys navigation और selection control करती हैं।
Shell Integrations
ये तीन bindings हैं जो fzf को superpower जैसा बनाती हैं। ये सीधे आपके shell में wire होती हैं और installation के बाद out of the box काम करती हैं।
Preview Window
Preview window fzf को एक selector से full browser में बदल देता है। आप files, syntax-highlighted code, images, git diffs — कुछ भी preview कर सकते हैं जो किसी command से pipe हो सके।
सामान्य Patterns
ये copy-paste recipes हैं जो fzf को अनिवार्य बनाती हैं। हर एक एक real problem solve करती है जो शायद आपको इसी हफ्ते हुई हो।
Tips
FZF_DEFAULT_COMMAND को default find के बजाय fd या rg इस्तेमाल करने के लिए set करें। ये तेज़ हैं, .gitignore respect करते हैं, और node_modules जैसे junk को automatically skip करते हैं। अपने shell profile में export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git' try करें।
Shell integrations को FZF_CTRL_T_COMMAND, FZF_CTRL_R_OPTS, और FZF_ALT_C_COMMAND से independently customize करें। उदाहरण के लिए, FZF_ALT_C_COMMAND='fd --type d' set करें ताकि Alt-C blazing-fast directory search के लिए fd इस्तेमाल करे और automatically .gitignore entries ignore करे।
अपने default fzf options FZF_DEFAULT_OPTS में रखें ताकि वे हर जगह apply हों। एक अच्छी शुरुआत: export FZF_DEFAULT_OPTS='--height 40% --reverse --border --preview-window right:50%:wrap'। यह आपको हर invocation पर preview pane के साथ एक compact, top-down layout देता है।
Custom actions जोड़ने के लिए --bind इस्तेमाल करें। उदाहरण के लिए, --bind 'ctrl-y:execute-silent(echo {} | pbcopy)' fzf छोड़े बिना current selection को clipboard पर copy करता है। आप किसी भी key को execute, reload, preview, या fzf के behavior को on the fly बदलने के लिए bind कर सकते हैं।
--preview command के पास placeholders हैं: {} पूरी line है, {1} पहला field है, {q} current query है, और {n} line number है। ये आपको wrapper script लिखे बिना surprisingly sophisticated previews बनाने देते हैं।
अपने custom scripts को user-friendly context देने के लिए fzf को --header के साथ chain करें। git branch | fzf --header "Switch to branch:" जैसा कुछ throwaway scripts को polished feel देता है। Search prompt text customize करने के लिए --prompt के साथ pair करें।
tmux में, fzf inline के बजाय popup में खुल सकता है। Centered floating popup window में fzf launch करने के लिए fzf-tmux -p 80%,60% इस्तेमाल करें। यह slick है, आपके main pane से बाहर रहता है, और काम होने पर गायब हो जाता है। एक बार try करने के बाद, inline fzf cramped लगेगा।