Skip to content

Quiz: fzf

← Back to quiz index

3 questions

L0 (1 questions)

1. How do you use fzf to interactively select and kill a process?

Show answer ps aux | fzf | awk '{print $2}' | xargs kill. Or with preview: ps aux | fzf --preview 'echo {}' | awk '{print $2}' | xargs kill

L1 (2 questions)

1. How do you use fzf with a preview window for file selection?

Show answer fzf --preview 'cat {}' shows file contents while browsing. Customize: --preview-window=right:60% for layout. Combine with fd: fd -t f | fzf --preview 'head -50 {}'. For git: git log --oneline | fzf --preview 'git show {1}'. The {} placeholder is replaced with the selected line.

2. What are the default fzf keybindings in a shell and how do you customize them?

Show answer Defaults: Ctrl-T (paste file path), Ctrl-R (search command history), Alt-C (cd into directory). Set FZF_DEFAULT_COMMAND to change the file source (e.g., fd instead of find). Set FZF_DEFAULT_OPTS for global options like --height 40% --layout=reverse. Keybindings are installed via the fzf shell integration script.