How can I delete a Linode by name using the Linode CLI?

Linode Staff

Is it possible to delete a Linode by its name, and not by its numerical id, using linode-cli?

1 Reply

Not directly, but you can write a script that accomplishes the same. The script I use to delete a Linode by name rather than ID number looks like this:

#!/usr/bin/env bash

linode-cli linodes delete $(linode-cli linodes list --text | grep "\b${1}\b" | awk '{print $1}')

The logic could be simplified by replacing the grep command with further awk logic, but this is the quick and dirty way I came up with. I used \b with grep to enforce word boundaries, so that the command does not accidentally delete any other similarly-named Linodes. You can save the script as anything you'd like - for example,, and call it like this:


Just be sure to replace $LINODE_TO_DELETE with the name of the Linode you're deleting.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct