How do I use CLI to delete Object Storage contents?

Linode Staff

When attempting to cancel Object Storage, how do I remove/delete objects, folders, and the buckets themselves using CLI?

4 Replies

In order to fully cancel Object Storage as expected, all contents within your buckets must be fully deleted. Some users delete objects and other components of Object Storage using their Cloud Manager, however, if you are unable to do this, using the CLI commands below may be an alternative method to ensure things are fully removed:

Removes object in folders:
linode-cli obj del $bucket $folder/$object.ext

Removes folders within bucket:
linode-cli obj rb $bucket/$folder

Removes bucket:
linode-cli obj rb $bucket

Because Object Storage is meant to be unstructured data, occasionally those who add folders to their buckets may find they can’t delete them, even if emptied. The second command above helps to both remove these folders. From there, you can delete the bucket, if it doesn’t get removed by the CLI command after a few moments. Hope this helps!

I tried this command

linode-cli obj rb $bucket/$folder

it returns that the folder was removed but I go to check I found the folder still there

@escaper01 --

The operating context here is that of a shell script…

Did you set the shell variables bucket and folder to values first?


linode-cli obj rb $bucket/$folder

— sw

Sorry but the rb command dosent delete the folder. It says it does but then the folder is still present and showing on the webpage interface. This happens even when the folder is empty.


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