- Documentation
Torch Object Storage
Tool Guide
tosutil
Quick start
Quick start
This topic describes how to quickly get started with tosutil, including its prerequisites and initialization process.
Prerequisites
- You have obtained the region and endpoint of the TOS server that will execute your command. For more information on TOS regions and endpoints, see Regions and endpoints.
Notes
The command examples in this guide apply exclusively to Linux and macOS systems. For Windows command syntax, see Command syntax. Step 1: Initialize tosutil
- (Optional) When using tosutil on Linux or macOS, run this command to add execute permission.
- Skip this step if you are using tosutil on Windows.
- Use the config command to initialize tosutil. Adjust the command according to your scenario.
- Using long-term access credentials
- Using temporary access credentials
warning
- Make sure that the endpoint you provide follows the TOS protocol. Endpoints that follow the S3 protocol are not supported. For more information on TOS regions and endpoints, see Regions and endpoints.
- After you configure the credentials via the config command, a .tosutilconfig file will be generated in your operating system's home directory. On macOS/Linux, this directory is ~, and on Windows, it is C:\Users\<username>. This file stores all tosutil configurations. To prevent security issues caused by key leakage, tosutil automatically encrypts your information.
- tosutil supports anonymous access to TOS. When accessing a bucket anonymously, you can retrieve publicly readable data and write data to buckets configured with public write permissions.
- In this case, you do not need to specify access credentials when using the config command for initial configuration. Simply set the relevant parameters to -i=, -k=, and -t=.
Step 2: Check version and connectivity
After initializing tosutil, you can use the following command to check its version and connectivity.
- Use the version command to check the tool's version.
- The command returns an output containing text similar to the following:
- Use the ls command to test for connectivity.
- The command returns an output containing text similar to the following:
tip
You can then judge the configuration result based on the output of the ls command.
- If the output contains Bucket number is:, then the configuration is correct.
- If the output contains Http status [403], then the access credentials that you provide are incorrect or lack the necessary permissions.
- If the output contains A connection attempt failed, it means that TOS cannot connect. Please check your network connection.
Step 3: Use tosutil
This section introduces the most common commands for creating buckets and uploading, downloading, and deleting objects using tosutil.
- Run this command to create a bucket named bucketname.
tip
The default region for creating buckets is the region set during initialization. To create a bucket in a different region, use the -re command. For more information, see Common parameters. - Run this command to upload the file.txt object to the bucketname bucket.
- Run this command to download the file.txt object from the bucketname bucket to your local device.
- Run this command to delete the file.txt object from the bucketname bucket.
warning
When you use the rm command to delete an object, tosutil prompts you to confirm with y/n. To force the deletion, add the -f parameter. See the rm command documentation for more information. - Run this command to upload the test_folder folder to the bucketname bucket.
- Run this command to download the test_folder folder from the bucketname bucket to your local device.
- Run this command to delete the test_folder folder from the bucketname bucket.
Help documentation
- tosutil includes built-in help documentation. You can use the help command to view it.
- The help documentation is available in both Chinese and English. Use the following command to switch the language of the documentation:
Last updated: 2025.12.17 18:33:42