Get started
Install the CLI
Windows, macOS, and Linux (including Ubuntu 23.04 and earlier)
-
Open a terminal application. For Windows, you can use either Powershell or the command prompt.
-
Run these commands to ensure that Python 3 and
pip3are both installed. If they're not, see Other installs: Python and pip.python3 --version pip3 --version -
To install Linode CLI, run this command:
pip3 install linode-cli --upgradeIf you see an error like this, you need to add your Python's
binfolder to your systemPATHenvironment variable. Steps to do this vary based on your operating system.WARNING: The script normalizer is installed in '/Users/USERNAME/Library/Python/3.9/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. -
If you're using Linode's Object Storage service, you also need to install the
botolibrary:pip3 install boto3 -
To confirm installation, run the help command:
linode-cli --help
Linux (Ubuntu 23.04 and later)
These releases of Ubuntu enforce PEP 668, which prevents you from installing Python packages system-wide using pip. Instead, you can install using apt or using pipx.
You environment returns this error if pip is run:
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.
See /usr/share/doc/python3.12/README.venv for more information.
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
Install using PipX
You can use pipx to install the Linode CLI, system-wide in an automatically managed isolated environment.
-
Install
pipx:sudo apt install pipx -y -
Ensure the
pipxpath is configured:pipx ensurepath -
Use
pipxto install the Linode CLI:pipx install linode-cli -
You can verify installation of the CLI by running the
--helpcommand:linode-cli --help
Other installs: Python and pip
If you don't already have python and pip installed on your system, follow these instructions to get the right versions.
Windows
Install Python 3 on Windows by downloading the installer package directly from Python's website:
-
Go to Python's Downloads page. Download the latest stable Python 3 package for Windows.
-
Open the installer package that was just downloaded. This is likely a
.exefile. -
Within the installer window, check "Add Python 3.x to PATH" and then select Customize installation.
-
Ensure that the
pipoption is checked and select Next. -
Under Advanced Options, ensure that the following options are checked:
- Install for all users
- Associate files with Python
- Create shortcuts for installed applications
- Add Python to environment variables
- Precompiled standard library
-
Select
Nextto proceed with the installation. Once the installation is complete, a message appears confirming that Python 3 was successfully installed.
macOS
Install Python 3 on macOS by downloading the package directly from Python's website:
-
Go to Python's Downloads page. Download the latest stable Python 3 package for macOS.
-
Open the installer package to begin the installation.
-
Follow the prompts to install Python3 and pip.
Linux
On most Linux distributions, you can use the distribution's package manager to install both the python3 and python3-pip packages.
-
Ubuntu and Debian: Ubuntu 22.x, 20.x, 18.x, and 16.x | Debian 11, 10, and 9
If you're using Ubuntu Linux 23.04 or later, you need to install the proper version of Python and use
pipx, rather than standardpip. (These versions of Linux don't support installs usingpip.)sudo apt update sudo apt install python3 && sudo apt install python3-pip -
CentOS Stream, RHEL 8, and Fedora: CentOS Stream 9 (and 8), CentOS 8, other RHEL derivatives (including AlmaLinux 8, and Rocky Linux 8), and Fedora.
sudo dnf upgrade sudo dnf install python3 && sudo dnf install python3-pip -
CentOS 7
sudo yum update sudo yum install python3 && sudo yum install python3-pip
Confirm installation
You can run any of these commands for verify installation:
python3 --versionpip3 --version(For standardpip)pipx --version
If you receive command not found, you may need to add Python3, Pip3, or PipX's locations to your $PATH.
To begin, you need to install and configure the CLI for use.
Configure the CLI
You need to authenticate your access to the CLI to use it. Use either of these methods to set it up.
Interactive configuration
With this method, you set up authentication via a token, as you initially interact with the CLI. Each time you interact with it again, you'll need to follow this same process.
-
Initiate the Linode CLI configuration process.
-
Web-based authentication: Prompts you to sign in to your account through a web browser.
linode-cli configure -
Manually create a personal access token: Prompts you for a token that you need to manually create. See Linode API Keys and Tokens.
linode-cli configure --token
-
-
After authenticating or providing a token, you see a series of prompts to select your preferred defaults, such as the region, Linode type, and distribution. These are optional and can be overridden when running individual commands. Update these defaults at any time by running
linode-cli configureagain or by editing the.config/linode-cliconfiguration file.
Non-interactive configuration
To configure the CLI without any interactive prompts, you can manually generate a token and then set it using an environment variable, replacing [token]:
export LINODE_CLI_TOKEN="[token]"
If you don't set this variable, the Linode CLI stops working until you set it again or until you set up the CLI using the interactive configuration method.
Example usage
To view a list of all Linodes on your account, run the following command:
linode-cli linodes list
The information shown is based on the information within your own account.
┌──────────┬────────────────────┬────────────┬───────────────┬───────────────────────┬─────────┬───────────────────┐
│ id │ label │ region │ type │ image │ status │ ipv4 │
├──────────┼────────────────────┼────────────┼───────────────┼───────────────────────┼─────────┼───────────────────┤
│ 00000001 │ example-instance │ us-east │ g6-standard-1 │ linode/ubuntu18.04 │ running │ 192.0.2.42 │
│ 00001111 │ centos-us-east │ us-east │ g6-nanode-1 │ linode/centos-stream9 │ running │ 192.0.2.108 │
└──────────┴────────────────────┴────────────┴───────────────┴───────────────────────┴─────────┴───────────────────┘
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
Output
To make information easy to ready, the Linode CLI outputs responses in a text-based table format. The data is split into rows and columns, with the top row containing the fields.
linode-cli regions list
┌──────────────┬─────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────┐
│ id │ country │ capabilities │ status │
├──────────────┼─────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┤
│ ap-west │ in │ Linodes, NodeBalancers, Block Storage, GPU Linodes, Kubernetes, <<CLOUD_FIREWALL>>, VLANs, Block Storage Migrations, Managed Databases │ ok │
│ ca-central │ ca │ Linodes, NodeBalancers, Block Storage, Kubernetes, <<CLOUD_FIREWALL>>, VLANs, Block Storage Migrations, Managed Databases │ ok │
│ ap-southeast │ au │ Linodes, NodeBalancers, Block Storage, Kubernetes, <<CLOUD_FIREWALL>>, VLANs, Block Storage Migrations, Managed Databases │ ok │
│ us-central │ us │ Linodes, NodeBalancers, Block Storage, Kubernetes, <<CLOUD_FIREWALL>>, Block Storage Migrations, Managed Databases │ ok │
│ us-west │ us │ Linodes, NodeBalancers, Block Storage, Kubernetes, <<CLOUD_FIREWALL>>, Block Storage Migrations, Managed Databases │ ok │
│ us-southeast │ us │ Linodes, NodeBalancers, Block Storage, Object Storage, GPU Linodes, Kubernetes, <<CLOUD_FIREWALL>>, VLANs, Block Storage Migrations, Managed Databases │ ok │
│ us-east │ us │ Linodes, NodeBalancers, Block Storage, Object Storage, GPU Linodes, Kubernetes, <<CLOUD_FIREWALL>>, Bare Metal, Block Storage Migrations, Managed Databases │ ok │
│ eu-west │ uk │ Linodes, NodeBalancers, Block Storage, Kubernetes, <<CLOUD_FIREWALL>>, Block Storage Migrations, Managed Databases │ ok │
│ ap-south │ sg │ Linodes, NodeBalancers, Block Storage, Object Storage, GPU Linodes, Kubernetes, <<CLOUD_FIREWALL>>, Block Storage Migrations, Managed Databases │ ok │
│ eu-central │ de │ Linodes, NodeBalancers, Block Storage, Object Storage, GPU Linodes, Kubernetes, <<CLOUD_FIREWALL>>, Block Storage Migrations, Managed Databases │ ok │
│ ap-northeast │ jp │ Linodes, NodeBalancers, Block Storage, Kubernetes, <<CLOUD_FIREWALL>>, Block Storage Migrations, Managed Databases │ ok │
└──────────────┴─────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────┘
Fields
By default, most Linode CLI responses do not contain all the available fields. To keep the information digestible, the Linode CLI outputs a smaller subset of all of available fields. This behavior can be adjusted using the commands below.
- Limited (default behavior): Outputs a limited subset of the available fields.
- All fields (
--all): Output all available fields. - Specific fields (
--format 'field1,field2'): Outputs only the fields specified within the given comma separated list.
Output format
The Linode CLI can output data in a variety of formats, as disclosed below:
- Tabular (default): Data is split into rows and columns, with the top row containing the fields.
- JSON (
--jsonor--json --pretty): Data is structured using JavaScript Object Notation (JSON), typically used for importing into applications that require JSON. The--prettytag is optional and makes the output more human readable. - Plain text (
--textor--text --delimiter ","): Data is outputted as plain text. By default, it uses a tab character as the delimiter, though this can be adjusted by specifying a custom character using the--delimited ","option.
Updated 44 minutes ago
