{"id":13448126,"url":"https://github.com/Backblaze/B2_Command_Line_Tool","last_synced_at":"2025-03-22T02:30:39.458Z","repository":{"id":38145840,"uuid":"46293472","full_name":"Backblaze/B2_Command_Line_Tool","owner":"Backblaze","description":"The command-line tool that gives easy access to all of the capabilities of B2 Cloud Storage","archived":false,"fork":false,"pushed_at":"2024-10-29T10:15:44.000Z","size":4037,"stargazers_count":543,"open_issues_count":51,"forks_count":124,"subscribers_count":41,"default_branch":"master","last_synced_at":"2024-10-29T12:18:15.170Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Backblaze.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-11-16T18:22:50.000Z","updated_at":"2024-10-28T23:11:21.000Z","dependencies_parsed_at":"2023-10-03T14:47:16.481Z","dependency_job_id":"9f1e7ff3-f3ae-4b7d-b144-2cae62f1304b","html_url":"https://github.com/Backblaze/B2_Command_Line_Tool","commit_stats":{"total_commits":1792,"total_committers":70,"mean_commits":25.6,"dds":0.6869419642857143,"last_synced_commit":"551001188e6651fc75c2984f81077d49ea162c6d"},"previous_names":[],"tags_count":73,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Backblaze%2FB2_Command_Line_Tool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Backblaze%2FB2_Command_Line_Tool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Backblaze%2FB2_Command_Line_Tool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Backblaze%2FB2_Command_Line_Tool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Backblaze","download_url":"https://codeload.github.com/Backblaze/B2_Command_Line_Tool/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244515571,"owners_count":20464912,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T05:01:36.419Z","updated_at":"2025-03-22T02:30:39.438Z","avatar_url":"https://github.com/Backblaze.png","language":"Python","readme":"# B2 Command Line Tool\n\n[![CI](https://github.com/Backblaze/B2_Command_Line_Tool/actions/workflows/ci.yml/badge.svg)](https://github.com/Backblaze/B2_Command_Line_Tool/actions/workflows/ci.yml)\u0026nbsp;[![License](https://img.shields.io/pypi/l/b2.svg?label=License)](https://pypi.python.org/pypi/b2)\u0026nbsp;[![python versions](https://img.shields.io/pypi/pyversions/b2.svg?label=python%20versions)](https://pypi.python.org/pypi/b2)\u0026nbsp;[![PyPI version](https://img.shields.io/pypi/v/b2.svg?label=PyPI%20version)](https://pypi.python.org/pypi/b2)\u0026nbsp;[![Docs](https://readthedocs.org/projects/b2-command-line-tool/badge/?version=master)](https://b2-command-line-tool.readthedocs.io/en/master/?badge=master)\n\nThe command-line tool that gives easy access to all of the capabilities of B2 Cloud Storage.\n\nThis program provides command-line access to the B2 service.\n\n## Documentation\n\nThe latest documentation is available on [Read the Docs](https://b2-command-line-tool.readthedocs.io/).\n\n## Installation\n\nFor detailed instructions on how to install the command line tool see our [quick start guide](https://www.backblaze.com/b2/docs/quick_command_line.html).\n\n### Homebrew\n\n[Homebrew](https://brew.sh/) is widely used in the Mac community, particularly amongst developers. We recommend using the [B2 CLI Homebrew](https://formulae.brew.sh/formula/b2-tools) formula as the quickest setup method for Mac users:\n\n```bash\nbrew install b2-tools\n```\n\n### Binaries\n\nStand-alone binaries are available for Linux and Windows; this is the most straightforward way to use the command-line tool and is sufficient in most use cases. The latest versions are available for download from the [Releases page](https://github.com/Backblaze/B2_Command_Line_Tool/releases).\n\n### Python Package Index\n\nYou can also install it in your Python environment ([virtualenv](https://pypi.org/project/virtualenv/) is recommended) from PyPI with:\n\n```bash\npip install b2[full]\n```\n\nThe extra dependencies improve debugging experience and, potentially, performance of `b2` CLI, but are not strictly required.\nYou can install the `b2` without them:\n\n```bash\n    pip install b2\n```\n\n### Docker\n\nFor a truly platform independent solution, use the official docker image: \n\n```bash\ndocker run backblazeit/b2:latest  ...\n```\n\nSee examples in [Usage/Docker image](#docker-image)\n\n### Installing from source\n\nNot recommended, unless you want to check if a current pre-release code solves a bug affecting you.\n\n```bash\npip install git+https://github.com/Backblaze/B2_Command_Line_Tool.git\n```\n\nIf you wish to contribute to or otherwise modify source code, please see our [contributing guidelines](CONTRIBUTING.md).\n\n## Usage\n\n```\nb2 account                Account management subcommands.\nb2 bucket                 Bucket management subcommands.\nb2 file                   File management subcommands.\nb2 install-autocomplete   Install autocomplete for supported shells.\nb2 key                    Application keys management subcommands.\nb2 license                Print the license information for this tool.\nb2 ls                     List files in a given folder.\nb2 replication            Replication rule management subcommands.\nb2 rm                     Remove a \"folder\" or a set of files matching a pattern.\nb2 sync                   Copy multiple files from source to destination.\nb2 version                Print the version number of this tool.\n```\n\nThe environment variable `B2_ACCOUNT_INFO` specifies the SQLite\nfile to use for caching authentication information.\nThe default file to use is: `~/.b2_account_info`.\n\nTo get more details on a specific command use `b2 \u003ccommand\u003e --help`.\n\nWhen authorizing with application keys, this tool requires that the key\nhave the `listBuckets` capability so that it can take the bucket names\nyou provide on the command line and translate them into bucket IDs for the\nB2 Storage service.  Each different command may required additional\ncapabilities. You can find the details for each command in the help for\nthat command.\n\n### Docker image\n\nThanks to [ApiVer methodology](#apiver-cli-versions-b2-vs-b2v3-b2v4-etc),\nyou should be perfectly fine using `b2:latest` version even in long-term support scripts,\nbut make sure to explicitly use `b2v4` command from the docker image as shown below.\n\n#### Authorization\n\nUser can either authorize on each command (`bucket list` is just a example here)\n\n```bash\nB2_APPLICATION_KEY=\u003ckey\u003e B2_APPLICATION_KEY_ID=\u003ckey-id\u003e docker run --rm -e B2_APPLICATION_KEY -e B2_APPLICATION_KEY_ID backblazeit/b2:latest b2v4 bucket list\n```\n\nor authorize once and keep the credentials persisted:\n\n```bash\ndocker run --rm -it -v b2:/root backblazeit/b2:latest b2v4 account authorize\ndocker run --rm -v b2:/root backblazeit/b2:latest b2v4 bucket list  # remember to include `-v` - authorization details are there\n```\n\n#### Downloading and uploading\n\nWhen uploading a single file, data can be passed to the container via a pipe:\n\n```bash\ncat source_file.txt | docker run -i --rm -v b2:/root backblazeit/b2:latest b2v4 upload-unbound-stream bucket_name - target_file_name\n```\n\nor by mounting local files in the docker container:\n\n```bash\ndocker run --rm -v b2:/root -v /home/user/path/to/data:/data backblazeit/b2:latest b2v4 file upload bucket_name /data/source_file.txt target_file_name\n```\n\n## ApiVer CLI versions (`b2` vs `b2v3`, `b2v4`, etc.)\n\nSummary:\n\n* in terminal, for best UX, use the latest apiver interface provided by `b2` command\n* for long-term support, i.e. in scripts, use `b2v4` command\n\nExplanation:\n\nWe use the `ApiVer` methodology so we can continue to evolve the `b2` command line tool,\nwhile also providing all the bugfixes to the old interface versions.\n\nIf you use the `b2` command, you're working with the latest stable interface.\nIt provides all the bells and whistles, latest features, and the best performance.\nWhile it's a great version to work with directly, but when writing a reliable, long-running script,\nyou want to ensure that your script won't break when we release a new version of the `b2` command.\n\nIn that case instead of using the `b2` command, you should use a version-bound interface e.g.: `b2v4`.\nThis command will always provide the same ApiVer 3 interface, regardless of the semantic version of the `b2` command.\nEven if the `b2` command goes into the ApiVer `4`, `6` or even `10` with some major changes,\n`b2v4` will still provide the same interface, same commands, and same parameters, with all the security and bug fixes.\nOver time, it might get slower as we may need to emulate some older behaviors, but we'll ensure that it won't break.\n\nYou may find the next interface under `_b2v5`, but please note, as suggested by `_` prefix,\nit is not yet stable and is not yet covered by guarantees listed above.\n\n## Contrib\n\n### Detailed logs\n\nVerbose logs to stdout can be enabled with the `--verbose` flag.\n\nA hidden flag `--debug-logs` can be used to enable logging to a `b2_cli.log` file (with log rotation at midnight) in current working directory. Please pay attention not to launch the tool from the directory that you are syncing, or the logs will get synced to the remote server (unless that is really what you want to achieve).\n\nFor advanced users, a hidden option `--log-config \u003cfilename.ini\u003e` can be used to enable logging in a user-defined format and verbosity. Check out the [example log configuration](contrib/debug_logs.ini).\n\n## Release History\n\nPlease refer to the [changelog](CHANGELOG.md).\n\n## Developer Info\n\nPlease see our [contributing guidelines](CONTRIBUTING.md).\n","funding_links":[],"categories":["Python","\u003ca id=\"tag-dev\" href=\"#tag-dev\"\u003eDev\u003c/a\u003e"],"sub_categories":["\u003ca id=\"tag-dev.storage\" href=\"#tag-dev.storage\"\u003eStorage\u003c/a\u003e"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBackblaze%2FB2_Command_Line_Tool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBackblaze%2FB2_Command_Line_Tool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBackblaze%2FB2_Command_Line_Tool/lists"}