All Products
Search
Document Center

Object Storage Service:Get started with ossutil

Last Updated:Mar 28, 2025

ossutil is a command-line tool that allows you to efficiently manage Object Storage Service (OSS) resources from Windows, macOS, and Linux. This topic describes how to perform common bucket and object management operations by using commands, including creating and deleting buckets, and uploading, downloading, listing, and deleting objects.

Note
  • In this topic, ossutil V2.0 is used. Compared with ossutil V1.0, ossutil V2.0 provides more advanced capabilities. We recommend that you use ossutil V2.0. ossutil V1.0 is also available. For information about how to use ossutil V1.0, see ossutil V1.0.

  • If you have installed and configured ossutil V2.0, you can quickly get started by referring to ossutil commands.

Prerequisites

Install ossutil

Linux

  1. Install the unzip tool.

    Alibaba Cloud Linux

    sudo yum install -y unzip

    CentOS

    sudo yum install -y unzip

    Ubuntu

    sudo apt install -y unzip
  2. Download the ossutil package.

    curl -o ossutil-2.1.0-linux-amd64.zip https://gosspublic.alicdn.com/ossutil/v2/2.1.0/ossutil-2.1.0-linux-amd64.zip
    Note

    In this example, ossutil for 64-bit x86 Linux is downloaded. To download ossutil for another system, see Download ossutil.

  3. Enter the directory in which the ossutil package is stored and run the following unzip command:

    unzip ossutil-2.1.0-linux-amd64.zip
  4. Enter the ossutil-2.1.0-linux-amd64 directory.

    cd ossutil-2.1.0-linux-amd64
  5. Run the following command in the current directory:

    chmod 755 ossutil
  6. Run the following command to make ossutil globally invocable:

    sudo mv ossutil /usr/local/bin/ && sudo ln -s /usr/local/bin/ossutil /usr/bin/ossutil
  7. Run the ossutil command to check whether ossutil is installed:

    ossutil

    If ossutil help information is returned, ossutil has been installed.

Windows

  1. Install ossutil.

    1. Download the ossutil package for your system architecture and bit version:

    2. Extract the file from the ossutil package to a directory and enter the directory.

    3. Configure an environment variable for the path of the file.

      1. Click the address bar to copy the path of the current folder.

      2. In the System variables section of the Environment Variables dialog box, locate and double-click the Path variable, click the New button, and paste the path of the file into the text box.

    4. Run the ossutil command to check whether ossutil is installed:

      ossutil

      If ossutil help information is returned, ossutil has been installed.

macOS

  1. Install ossutil.

    curl -o ossutil-2.1.0-mac-arm64.zip  https://gosspublic.alicdn.com/ossutil/v2/2.1.0/ossutil-2.1.0-mac-arm64.zip
    Note

    In this example, ossutil for 64-bit macOS ARM is downloaded. To download ossutil for another system, see Download ossutil.

  2. Enter the directory in which the ossutil package is stored and run the following unzip command:

    unzip ossutil-2.1.0-mac-arm64.zip
  3. Enter the ossutil-2.1.0-mac-arm64 directory.

    cd ossutil-2.1.0-mac-arm64
  4. Run the following command in the current directory:

    chmod 755 ossutil
  5. Run the following command to make ossutil globally invocable:

    sudo mv ossutil /usr/local/bin/ && sudo ln -s /usr/local/bin/ossutil /usr/bin/ossutil
  6. Run the ossutil command to check whether ossutil is installed:

    ossutil

    If ossutil help information is returned, ossutil has been installed.

Configure ossutil

  1. Configure ossutil.

    ossutil config
  2. Configure the path of the configuration file. You can press the Enter key to use the default path of the configuration file.

    This example shows how to configure ossutil on Linux.

    Please enter the config file name,the file name can include path(default /root/.ossutilconfig, carriage return will use the default file. If you specified this option to other file, you should specify --config-file option to the file when you use other commands):
  3. Enter the AccessKey ID that you created earlier.

    Please enter Access Key ID [****************id]:LTAI****************
  4. Enter the AccessKey secret that you created earlier.

    Please enter Access Key Secret [****************sk]:R6vg*********************
  5. Enter the ID of the region in which your data is stored on OSS.

    Please enter Region [cn-hangzhou]:cn-hangzhou

    In this example, the ID of the China (Hangzhou) region is used. For information about the IDs of other regions, see Regions and endpoints.

  6. Specify an endpoint for the region. You can press Enter to skip this step. After you specify the region ID in the previous step, the public endpoint for the region is used by default. For example, if you set region-id to cn-hangzhou, the public endpoint https://oss-cn-hangzhou.aliyuncs.com endpoint is used by default. If you want to use a different endpoint, enter the endpoint.

    Please enter Endpoint (optional, use public endpoint by default) [None]: https://oss-cn-hangzhou.aliyuncs.com

Sample commands

  1. Create a bucket.

     ossutil mb oss://examplebucket

    If the output is similar to the following content, the bucket has been created.

    0.668238(s) elapsed
  2. Upload an object to the bucket.

    1. Create a local file named uploadFile.txt.

      echo 'Hello, OSS!' > uploadFile.txt
    2. Upload the file to the examplebucket.

      ossutil cp uploadFile.txt oss://examplebucket

      If the output is similar to the following content, the file has been uploaded to the bucket.

      Success: Total 1 file, size 12 B, Upload done:(1 objects, 12 B), avg 44 B/s
      
      0.271779(s) elapsed
  3. Download the object.

    Download the uploadFile.txt object from the bucket to a directory named localfolder.

    ossutil cp oss://examplebucket/uploadFile.txt localfolder/

    If the output is similar to the following content, the object has been downloaded to the local directory.

    Success: Total 1 object, size 12 B, Download done:(1 files, 12 B), avg 74 B/s
    
    0.162447(s) elapsed
  4. List objects in the bucket.

    ossutil ls oss://examplebucket

    If the output is similar to the following content, objects in the bucket have been listed.

    LastModifiedTime                   Size(B)  StorageClass   ETAG                                  ObjectName
    2024-11-26 14:35:29 +0800 CST           12      Standard   1103F650EB2C292D179A032D2A97B0F5      oss://examplebucket/uploadFile.txt
    Object Number is: 1
    
    0.124679(s) elapsed
  5. Delete the uploadFile.txt object from the bucket.

    ossutil rm oss://examplebucket/uploadFile.txt

    If the output is similar to the following content, the object has been deleted from the bucket.

    0.295530(s) elapsed
  6. Delete the bucket.

    ossutil rb oss://examplebucket

    If the output is similar to the following content, the bucket has been deleted.

    0.478659(s) elapsed

Related topic

FAQ