Quick Tip
Quickly Edit the Last Command with `fc`
Challenge: You just typed a long command, realized a typo or a small omission, and don’t want to retype it all or painstakingly use arrow keys and backspace.
The Solution: Use the `fc` (fix command) built-in to edit and re-execute your last command.
fc
Why it works: This command opens your default text editor (usually `vi` or `nano`) with your last command. Make your edits, save, and exit the editor. The shell will then execute the modified command. For older commands, you can use `fc -10` to edit the 10th to last command, or `fc N M` to edit commands from N to M.
Pro-Tip: Use `fc -e nano` to explicitly specify `nano` as your editor, even if it’s not your default.
Linux Tips & Tricks | © ngelinux.com | 4/27/2026
