homeblogs about

Example

BASH AND EXCLAMATION MARKS !!!!

2023-11-08 10:03AM #bash #cli #terminal

In case you didn't know, exclamation marks play an important role in the bash workflow, especially for your command history!

ok... let me explain that weird screenshot on top now. Actually it's simple :

Pretty NEAT right !?

So let's talk about it, the ! invokes history expansion, a feature that originally appeared in the C shell, back in the days before you could count on terminals to have arrow keys. It's especially useful if you add the current command number to the prompt (PS1="\!$ ") so you can quickly look at your screen to get numbers for past commands.

So, am not going to go deep inside possibilities here but just give some cool cheat-sheets from exclamations marks when you're on your terminal !

This is a pretty short list of the cool ones :

With these 4 items, you can basically play/mix around with your bash history and get great stuffs like the one up there with a substitution string.


<< blogs


githublinkedintwittertelegramemail