DEV Community

Richard
Richard

Posted on

3 4

So you made a typo in the console...

So here is a cool thing you can do in #bash or in any #cli or #commandline that I am aware of.

Here is an example, lets create an arbitrary BASH command with a nice obvious typo in it. I'll create some generic files:

touch cyan-swatch.txt maagenta-swatch.txt yellow-swatch.txt black-swatch.txt
Enter fullscreen mode Exit fullscreen mode

Oops, I made a boo-boo, see it? I mis-spelled the word magenta.

So, most people know you can press the ↑ up-arrow and it will show your last-typed command. But then you have to scroll alllll the way over to where you made the typo and manually remove the extra letter or whatever it is you have to do. But there is a better way!

Wouldn't it be cool if there was a way to tell the CLI, "Hey, I need you to replace this thing with this thing in my last command."

Here it is:

^maagenta^magenta
Enter fullscreen mode Exit fullscreen mode

This command will take the last command, substitute the first string maagenta with magenta, and run the command again.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more