KISS πŸ‡ΊπŸ‡¦

Stop the war!

Stop the war in Ukraine! Fuck putin!

More information is at: https://war.ukraine.ua/.

There is a fund to support the Ukrainian Army: https://savelife.in.ua/en/donate/, and there is a special bank account that accepts funds in multiple currencies: https://bank.gov.ua/en/about/support-the-armed-forces. I donated to them. Please donate if you can!

Killer putin

Killer putin. Source: politico.eu.

Arrested putin

"It hasn't happened yet, but it will happen sooner or later. Beautiful photo, isn't it?" Source: twitter.

Bash/zsh: edit latest command

| comments

Good evening, folks!

The other day, I issued a long command in bash, and it turned out it was wrong, I needed to replace all 20 commas with spaces. Editing the line manually is not an option, it was too long. Moreover, I knew there was a hotkey to edit last command in an editor, but forgot it. Searching for a while I bumped into this article (http://www.vim-fu.com/editing-a-long-bash-command-using-vim/), which reminded me that the combination is Ctrl-X, Ctrl-E by default.

However, the comments to the article added some useful information. There is an utility called fc, which does the same and even more, it can push not only the latest command into an editor, vim in my case. That’s nice, but what if I decided not to issue the command after editing? The same comments moved me to learn a vim’s command I didn’t know about. It’s :cq, which doesn’t save the file and exits with an error code.

To reiterate:

  • Ctrl-X, Ctrl-E — combination to edit the latest command in an editor. Works in bash and zsh.

  • fc — tool that does the same.

  • :cq — vim’s command to exit with an error code. Use it not to run the edited command.

Never stop learning!

Comments