Updated on 2024-02-29 GMT+08:00

Introduction to obsutil

obsutil is a command line tool for accessing and managing OBS. You can use this tool to perform common configurations on OBS, such as creating buckets, and uploading, downloading, and deleting files/folders. If you are familiar with the command line interface (CLI), obsutil can bring you better experience in batch processing and automated tasks.

obsutil is compatible with Windows, Linux, and macOS operating systems (OSs). Table 1 lists the recommended OS versions. To obtain the obsutil download links for different OSs, refer to Downloading and Installing obsutil.

Table 1 Recommended OS versions for using obsutil

OS

Recommended Version

Windows

  • Windows 7
  • Windows 8
  • Windows 10
  • Windows Server 2016

Linux

  • SUSE 11
  • EulerOS 2
  • CentOS 7

macOS

macOS 10.13.4

Advantages

obsutil features the following advantages:

  1. Simple and easy to use
  2. Lightweight and installation-free
  3. Compatible with Windows, Linux, and macOS
  4. Diversified configurations and excellent performance

Application Scenarios

  • Automated backup and archiving, for example, periodically uploading local data to OBS
  • Scenarios where other tools (like OBS Browser+) cannot be used, such as synchronously uploading, downloading, and copying objects

Functions

Table 2 lists obsutil functions.

Table 2 obsutil functions

Function

Description

Basic operations on buckets

Create buckets of different storage classes in specific regions, delete buckets, and obtain the bucket list and configuration information.

Basic operations on objects

Manage objects, including uploading, downloading, deleting, and listing objects. Supported operations are detailed as follows:

  • Upload one or more files or folders.
  • Upload large files in multiple parts.
  • Synchronously upload, download, and copy incremental objects.
  • Copy a single object or copy multiple objects in batches by object name prefix.
  • Move a single object or move objects in batches by object name prefix.
  • Resume failed upload, download, or copy tasks.

Logging

Configure logging on your client to record bucket and object operations for statistical analysis.

Advanced bucket and object management operations are being developed continuously, and will be available in later versions of obsutil. You can use these advanced functions on OBS Console.

Command Line Structure

The obsutil command line structures are as follows:

  • In Windows

    obsutil command [parameters...] [options...]

  • In Linux or macOS

    ./obsutil command [parameters...] [options...]

  • command indicates the command to be executed, for example, ls or cp.
  • parameters indicates the mandatory parameters of the command, for example, the bucket name during bucket creation.
  • options indicates the additional parameters (optional) of the command. Additional parameters must be preceded with a hyphen (-) when you run the command.
  • The square brackets ([]) are not part of the command. Do not enclose parameter values with them when entering a command.
  • If the command contains special characters including ampersands (&), angle brackets (<) and (>), and spaces, they need to be escaped using quotation marks. Use single quotation marks for Linux or macOS and quotation marks for Windows.
  • Additional parameters can be input in the -key=value or -key value format, for example, -acl=private, or -acl private. There is no difference between the two formats. Select either one as you like.
  • In Windows, you can directly execute obsutil.exe to enter an interactive command mode. In this mode, you can input command [parameters...] [options...] without obsutil to run a command. An example is provided as follows:
    Enter "exit" or "quit" to logout
    Enter "help" or "help command" to show help docs
    Input your command:
    -->ls -limit=3 -s
    obs://bucket-001
    obs://bucket-002
    obs://bucket-003
    Bucket number: 3
    
    Input your command:
    -->
  • If you use SSH to remotely log in to the Linux or macOS for running obsutil commands, you are advised to set TMOUT=0 to prevent the program from exiting due to the expiration of the SSH session.