Guides - Linode CLI Commands for Compute Instances
Access the entire Linode platform from the command line, easily adding, removing, or modifying services.
Tasks related to Linode instances are performed with linode-cli linodes [ACTION].
List all of the Linodes on your account:
linode-cli linodes listFilter results to a particular region:
linode-cli linodes list --region us-eastFiltering works on many fields throughout the CLI. Use
--helpfor each action to see which properties are filterable.Create a new Linode:
linode-cli linodes create --root_pass mypasswordThe defaults you specified when configuring the CLI will be used for the new Linode’s type, region, and image. Override these options by specifying the values:
linode-cli linodes create --root_pass mypassword --region us-east --image linode/debian9 --group webserversIf you are not writing a script, it is more secure to use
--root_passwithout specifying a password. You will then be prompted to enter a password:linode-cli linodes create --root_passFor commands targeting a specific Linode, you will need that Linode’s ID. The ID is returned when creating the Linode, and can be viewed by listing the Linodes on your account as described above. Store the ID of the new Linode (or an existing Linode) for later use:
export linode_id=<id-string>View details about a particular Linode:
linode-cli linodes view $linode_idBoot, shut down, or reboot a Linode:
linode-cli linodes boot $linode_id linode-cli linodes reboot $linode_id linode-cli linodes shutdown $linode_idView a list of available IP addresses for a specific Linode:
linode-cli linodes ips-list $linode_idAdd a private IP address to a Linode:
linode-cli linodes ip-add $linode_id --type ipv4 --public falseCreate a new disk for a Linode:
linode-cli linodes disk-create $linode_id --size 2700 --root_pass mypassword --filesystem raw --no-defaultsNote Even if you set the--filesystemtoraw, the defaults you specified when configuring the CLI will be used for setting a Linode’s disk image for this disk, overriding the filesystem setting. To create a disk without the default image, using only the parameters you send in this command, use the--no-defaultsflag.List all disks provisioned for a Linode:
linode-cli linodes disks-list $linode_idUpgrade your Linode. If an upgrade is available for the specified Linode, it will be placed in the Migration Queue. It will then be automatically shut down, migrated, and returned to its last state:
linode-cli linodes upgrade $linode_idRebuild a Linode:
linode-cli linodes rebuild $linode_id --image linode/debian9 --root_passRebuild a Linode, adding a populated
authorized_keysfile:linode-cli linodes rebuild $linode_id --image linode/debian9 --root_pass --authorized_keys "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEC+DOVfw+8Jsw1IPrYCcU9/HCuKayCsV8bXjsHqX/Zq email@example.com"If your key exists on your filesystem, you can also substitute its value in the CLI command with
cat. For example:linode-cli linodes rebuild $linode_id --image linode/debian9 --root_pass --authorized_keys "$(cat ~/.ssh/id_rsa.pub)"
Many other actions are available. Use linode-cli linodes --help for a complete list.
This page was originally published on