DEV Community

Cover image for [Video] Super Useful (lesser known) Terminal Command
Benjamin Kadel
Benjamin Kadel

Posted on

[Video] Super Useful (lesser known) Terminal Command

Any Terminal users out there?

Hey Folks,
So just want to keep this short as the content of this post is really the video and the explanation/tutorial...

To avoid people getting annoyed by the "click-baity" title of the video and post Ill tell you right now the command in question is:

(SPOILERS)
(SPOILERS)
(SPOILERS)

...

fc

fc (fix command)

I found recently that many of the people I know that use the Terminal didn't know about this incredible (often life/time saving) command. Which lets you basically load the last command you entered into an EDITOR in the Terminal and edit it before saving and closing the editor to automatically trigger the "tweaked" command.

I mess up my commands on such a regular basis that this fc command is a life saver and my workflow would heavily suffer without it!

Feel free to watch the video (below) to find out more...

Tutorial starts at...

I thought I would just add this timestamp as there is a little pre-video fluff for my subs before the content, so if you want to skip ahead to the actual tutorial bits then this is the timestamp

01:24 - https://youtu.be/vKQkg7Mt4jg?t=84

The Video

Links discussed in the video

Bash Builtin:
https://www.gnu.org/software/bash/manual/html_node/Bash-Builtins.html
https://en.wikipedia.org/wiki/Shell_builtin

fc command:
https://www.systutorials.com/docs/linux/man/1p-fc/
https://en.wikipedia.org/wiki/Fc_(Unix)
https://www.computerhope.com/unix/uhistory.htm

Onwards

If you have ANY feedback or questions at all please let me know in the comments below or reach out to me on twitter:

My Twitter (@ben_kadel)

Thanks for reading and possibly watching!

Top comments (9)

Collapse
 
moopet profile image
Ben Sinclair • Edited

If I don't want to run the command I'm editing - if I change my mind - then I can't prevent it. Either exiting with no changes or exiting without saving will still result in the command being run. I suppose I could add a hash to the start of the line to comment it out but that seems like a bit of a hack.

I've been vaguely aware of fc for a while, but I haven't seen any benefit to it except over extremely long command lines, which I'd prefer were split out in a script anyway.

Collapse
 
ghost profile image
Ghost

years living in the terminal and I didn't know, a little ashamed, a lot excited to add to the workflow :D

PS: Nice YT channel by the way, you got a new subscriber

Collapse
 
kardelio profile image
Benjamin Kadel

Yeh me too matey! Only found out about it a few months ago and it blew my mind!

PS: Aww thanks so much thats incredibly kind! If there is anything else you think i should cover in a future vid let me know :D

Collapse
 
ghost profile image
Ghost

Have you thought about CLI tools to replace WYSIWYG word processors and slides? is a bit topic tho. I like RestructuredText and rst2pdf, but there is also markdown and LaTeX, and for presentations, things like:

impress.js.org/#/title
ttps://revealjs.com
marcolago.github.io/flowtime.js/

I don't know how well known are solutions like those. I haven't replaced spreadsheets entirely yet, but the rest is replaced for me.

And RSS/Atom is also tech I'm not sure everyone is aware of, and:
1) you can do it entirely from the CLI (I us Newsboat)
2) with privacy concerns is perfect, no tracking, no ads, no distractions, very lightweight.
3) You can check even reddit, youtube, github repos, etc.

Thread Thread
 
kardelio profile image
Benjamin Kadel

This is awesome!!
Thank you so much for this idea!
Ill have a good look into all of this to be honest I guess I dont know much about the above myself either but seems like a really interesting and vast set of topics to cover!
Very Cool

Thread Thread
 
ghost profile image
Ghost

feel free to ask, happy to help

Collapse
 
ghost profile image
Ghost

Is some sort of sign of mild OCD, the bother it gives me the lack of space after your prompt? 8|

Collapse
 
kardelio profile image
Benjamin Kadel

Hahaha I know someone else that it freaks out too I think thats why i kept it hahaha

Thread Thread
 
ghost profile image
Ghost

Well at least there is a good reason, I feel better now :]