An alias for new aliases

Devin Finzer
May 4, 2016 · 1 min read
Image for post
Image for post
new-alias command in action

If you ever use your terminal, you’ve no doubt found yourself typing the same commands over and over again. To speed that process up, you’ve probably made a few aliases — simple commands that automate common tasks: cd’ing into a deep directory, tailing and grepping logs, running servers, etc.

But have you ever been on the fence about creating a new alias? You might say to yourself: this command isn’t that long, I’d rather just type it in yet another time — rather than open up my bash profile and make an alias for it.

Here’s a command that will eliminate those moments — an alias (technically a function) for creating a new alias. This command takes your last command and sticks it in your ~/.bash_profile with whatever alias you specify.

So for example, you could run:

After running that command, run:

Voila. You have a new alias at your immediate disposal called tail-logs. Run tail-logs in your terminal and you’ll start tailing that Heroku app.

The Lazy Developer

Helping developers be more lazy.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store