Filters
CLI - Get Started
Updated
The Linode CLI is a wrapper around the Linode API that allows you to manage your Linode account from the command line. Virtually any task that can be done through the Linode Manager can be done through the CLI, making it an excellent tool for scripting.
This guide describes the basics of installing and working with the CLI. It also offers examples illustrating how to complete common tasks using the CLI.
Install the CLI
The easiest way to install the CLI is through Pip:
Install the CLI:
pip3 install linode-cli --upgrade
You need a Personal Access Token to use the CLI. Use the Linode Cloud Manager to obtain a token.
The first time you run any command, you will be prompted with the CLI’s configuration script. Paste your access token (which will then be used by default for all requests made through the CLI) at the prompt. You will be prompted to choose defaults for Linodes created through the CLI (region, type, and image). These are optional, and can be overridden for individual commands. Update these defaults at any time by running
linode-cli configure
:Welcome to the Linode CLI. This will walk you through some initial setup. First, we need a Personal Access Token. To get one, please visit https://cloud.linode.com/profile/tokens and click "Create a Personal Access Token". The CLI needs access to everything on your account to work correctly. Personal Access Token:
NoteThe CLI installs a bash completion file. On OSX, you may have to source this file before it can be used. To do this, addsource /etc/bash_completion.d/linode-cli.sh
to your~/.bashrc
file.
Using the CLI for Support
List your Support Tickets:
linode-cli tickets list
Open a new Ticket:
linode-cli tickets create --description "Detailed description of the issue" --summary "Summary or quick title for the Ticket"
If your issue concerns a particular Linode, Volume, Domain, or NodeBalancer, pass the ID with
--domain_id
,--linode-id
,--volume_id
, etc.List replies for a Ticket:
linode-cli tickets replies $ticket_id
Reply to a Ticket:
linode-cli tickets reply $ticket_id --description "The content of your reply"
Options
Help
View information about any part of the CLI, including available actions and required parameters, with the --help
flag:
linode-cli --help
linode-cli linodes --help
linode-cli linodes create --help
Customize Output Fields
By default, the CLI displays a set of pre-selected fields for each type of response. If you would like to see all available fields, use the --all
flag:
linode-cli linodes list --all
Specify exactly which fields you would like to receive with the -format
option:
linode-cli linodes list --format 'id,region,memory'
JSON Output
The CLI returns output in tabulated format for easy readability. If you prefer to work with JSON, use the --json
flag. Adding the --pretty
flag formats the JSON output to make it more readable:
linode-cli regions list --json --pretty
|
|
Machine Readable Output
You can also display the output as plain text. By default, tabs are used as a delimiter, but you can specify another character with the --delimiter
option:
linode-cli regions list --text
|
|
linode-cli regions list --text --delimiter ";"
|
|
This page was originally published on