Skip to content

fc

Usage
fc [command_prefix]

Edits the last shell command – or the most recent one matching a prefix – in $EDITOR, then executes the result. Bash-style fc behaviour. $EDITOR may carry arguments (e.g. “code --wait”); falls back to vi when unset. Multi-line commands keep their newlines, the scratch file is private (mode 600) and always removed, and an empty buffer aborts without executing.

command_prefix Search history for the newest command matching this
0 The edited command was queued for execution
1 History lookup found nothing, or the buffer was left empty
Terminal window
fc
fc git

Classification: bypasses-shadow(rm), self-limiting(cat)