How to install and use command line tools in Heroku

What is Heroku Command Line:

The heroku command-line tool is an interface to the Heroku Platform API and includes support for things like creating/renaming apps, running one-off dynos, taking backups, and configuring add-ons. It is generally installed in your local development operating system.

Installing the Heroku CLI on Ubuntu: Use following steps to properly install heroku in your Ubuntu system:

1.  Run the following command in your terminal to install heroku toolbelt:

wget -O- https://toolbelt.heroku.com/install-ubuntu.sh | sh

2.  To verify your toolbelt installation use the following command:

heroku --version

After running the above command, you should be able to see the result like following:

heroku-toolbelt/3.43.5 (i686-linux) ruby/1.9.3

3.  To find out where the executable is located, run the following command:

which heroku

After running this command, result should be similar to this:

/usr/local/heroku/bin/heroku

The path to the heroku command should not be a Ruby gem directory. If it is, uninstall it and any other heroku gems using the following command:

gem uninstall heroku –all Log in to Heroku:

4.  You can run the following command to log in:

heroku login

You will be asked to enter your Heroku credentials the first time you run a command; after the first time, your email address and an API token will be saved to ~/.netrc for future use.

Using command line tools in Heroku: After installing and log in, you can use heroku command line to perform the various operation of your choice, like following:

1.  To get a list of apps you created or are a collaborator on, run following command:

heroku apps

It will list all the apps on heroku that you are eligible to access.

2.  If you have multiple heroku apps or want to execute an app command outside of a local working copy, you can specify an explicit app name as follows:

heroku apps:info --app example-abc

It will show the detail of your app like following:

=== example-abc

Add-ons: heroku plugin you have used for your app:

Collaborators: ashish.gautam@webners.com
deepika.saini@webners.com
ishpreet.kaur@webners.com
kailash.kumar@webners.com
manju.kashyap@webners.com

Dynos : web: 1
Git URL: https://git.heroku.com/example-abc.git
Owner: abc@mailinator.com
Region: us
Repo Size: 44 MB
Slug Size: 27 MB
Stack: cedar-14

Leave a Reply

Your email address will not be published. Required fields are marked *