Updated on 2023-03-16 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, uploading and downloading files/folders, and deleting files/folders. If you are familiar with command line interface (CLI), obsutil is a good choice for batch processing and automated tasks.

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

Table 1 Recommended OS versions for using obsutil

Operating System

Recommended Version

Windows

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

Linux

  • SUSE 11
  • EulerOS 2
  • CentOS 7

macOS

macOS 10.13.4

Tool Advantages

obsutil features the following advantages:

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

Application Scenarios

  • Automated backup and archiving, for example, periodically uploading local data to OBS.
  • Scenarios that cannot be implemented using other tools such as OBS Browser+, for example, 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

Allows you to configure logging on the client side to record operations on buckets and objects for statistics analysis later.

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 basic parameters (mandatory) of the command, for example, bucket name when creating a bucket.
  • 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.