TMAC.IO

Protip: calling arguments in your last shell command

Introduction

Tommy McDonald


Protip: calling arguments in your last shell command

Posted by Tommy McDonald on .
Featured

Protip: calling arguments in your last shell command

Posted by Tommy McDonald on .

Y'all know it, sometimes you mess up typing in the shell. It happens. Luckily there's a pretty neat way to call specific arguments from a previous command, and I'm gonna write about one way.

Imagine that you do this:

$ cd ~/Documents/so/many/nested/folders/file.txt

You know you can't cd into a file. You meant to open that in Atom. But "aww man, I don't want to type that path again and I'm too lazy to be bothered to do anything else". Don't fear! !!$ is here.

Instead of retyping all that, just type:

$ atom !!$

What this does is runs a command against the first argument in the last command you ran. Nifty!

Tommy McDonald

View Comments...