b2
Manage Backblaze B2 cloud storage files
TLDR
Access your account
List the existing buckets in your account
Create a bucket, provide the bucket name, and access type (e.g. allPublic or allPrivate)
Upload a file. Choose a file, bucket, and a folder
Upload a source directory to a Backblaze B2 bucket destination
Copy a file from one bucket to another bucket
Show the files in your bucket
Remove a "folder" or a set of files matching a pattern
SYNOPSIS
b2 [GLOBAL_OPTIONS] <COMMAND> [COMMAND_OPTIONS] [ARGUMENTS]
Examples:
b2 authorize <accountId> <applicationKey>
b2 ls --long b2://my-bucket
b2 upload_file --no-progress my-bucket local_file.txt remote_path/file.txt
PARAMETERS
--help
Displays a help message for the b2 command or a specific subcommand.
--version
Shows the installed version number of the b2 command-line tool.
--debug
Enables verbose debug logging, useful for troubleshooting issues.
--account-id <ID>
Specifies the Backblaze B2 account ID, overriding any ID stored in the configuration file.
--application-key <KEY>
Specifies the Backblaze B2 application key, overriding any key stored in the configuration file.
--skip-by-hash
During uploads, if a file with the same name and SHA1 hash already exists at the destination, the upload is skipped.
--no-progress
Disables the display of the progress bar during file uploads or downloads.
DESCRIPTION
The b2 command-line tool is a versatile utility for interacting with Backblaze B2 Cloud Storage. It allows users to perform various operations on their B2 buckets and files directly from the command line, providing a powerful interface for automating cloud storage tasks. Key functionalities include listing buckets and files, uploading and downloading data, managing file versions, and handling bucket lifecycle rules. It serves as a programmatic interface ideal for scripts and integration into larger workflows, ensuring secure and efficient data transfers. Being Python-based, it is commonly installed via pip and requires an active Backblaze B2 account for full functionality.
CAVEATS
The b2 command is not a standard Linux utility and must be installed separately (e.g., using pip).
Requires an active Backblaze B2 account and proper authorization before most operations can be performed.
Internet connectivity is essential for interacting with the B2 cloud storage service.
Security: Always protect your account ID and application keys. Avoid hardcoding them directly in scripts where possible; use environment variables or secure configuration methods.
AUTHENTICATION AND CONFIGURATION
Before using most b2 commands, you must authenticate. This is typically done via b2 authorize <accountId> <applicationKey>. This command stores your credentials securely in a configuration file (usually ~/.b2_account_info), allowing subsequent commands to operate without re-entering credentials. You can create multiple application keys in the Backblaze B2 web interface with different permissions.
SUBCOMMANDS STRUCTURE
The b2 tool employs a subcommand structure. After the main b2 command, you specify the operation you want to perform (e.g., ls, upload_file, delete_file, sync). Each subcommand has its own specific options and arguments. For example, to see options for listing files, you would run b2 ls --help.
HISTORY
The b2 command-line tool was developed as a crucial interface for Backblaze B2 Cloud Storage, which launched in 2015. Its inception provided users with a robust programmatic method to manage their cloud data, complementing the web-based interface. Written in Python, its development has closely tracked the evolution of the B2 API, continuously adding features for efficient data management, synchronization, and automation, making it an indispensable tool for developers and system administrators utilizing Backblaze B2.