Skip to the content.

A few days ago, I learned about a command that you can use to edit the last command you typed into your terminal.

Imagine you are writing a very long one-lined command and you are absolutely sure that it will work, but after pressing the ENTER button you find out that you mistyped something.

Now you have to use the arrow keys and/or POS1/END to navigate inside your one-lined command, which is really annoying if your command is so long that your terminal has to scroll to display everything. :(

The fc command can be of great use to you!

Simply type ‘fc’ and you can edit your command in whatever is set as your favourite EDITOR (mine is vim). Now you have the possibility to do things as ‘search-and-replace’ and another nice features. :)