DEV Community

Cover image for Bash! Bash! Bang! Bang!
Steve Latham
Steve Latham

Posted on

7

Bash! Bash! Bang! Bang!

The Bang Bang (!!)

What is the Bang Bang? Typing two exclamation points into your command-line and hitting your enter key with as much force as you can muster.

!! = Play the last command again, Sam.

Example:

Say you are installing an npm package globally (as you do): -

npm install -g <package_name>

Only to receive lots of permission denied errors. That’s right, you’ve forgotten to use “sudo” again, haven’t you!

You could press the up arrow and then navigate to the start of the line and type “sudo”, hit space and then meekly press the enter key.

Instead, though, you can roll out the almighty Bang Bang: -

sudo !! boom

In our example, that is equivalent to: -

sudo npm install –g <package_name>

You will eventually be using this shortcut everywhere you can.

After travelling to work only to realise you have forgotten your pass, just think -

pick up pass !!

Then, if that doesn't work, deploy the big guns: -

sudo !!

Problem solved.

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

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

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay