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:
heroku logs --tail --app test-app | grep router --line-bufferedAfter running that command, run:
new-alias tail-logsVoila. 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.