tencent cloud

Cloud Object Storage

Release Notes and Announcements
Release Notes
Announcements
Product Introduction
Overview
Features
Use Cases
Strengths
Concepts
Regions and Access Endpoints
Specifications and Limits
Service Regions and Service Providers
Billing
Billing Overview
Billing Method
Billable Items
Free Tier
Billing Examples
Viewing and Downloading Bill
Payment Overdue
FAQs
Getting Started
Console
Getting Started with COSBrowser
User Guide
Creating Request
Bucket
Object
Data Management
Batch Operation
Global Acceleration
Monitoring and Alarms
Operations Center
Data Processing
Content Moderation
Smart Toolbox
Data Processing Workflow
Application Integration
User Tools
Tool Overview
Installation and Configuration of Environment
COSBrowser
COSCLI (Beta)
COSCMD
COS Migration
FTP Server
Hadoop
COSDistCp
HDFS TO COS
GooseFS-Lite
Online Tools
Diagnostic Tool
Use Cases
Overview
Access Control and Permission Management
Performance Optimization
Accessing COS with AWS S3 SDK
Data Disaster Recovery and Backup
Domain Name Management Practice
Image Processing
Audio/Video Practices
Workflow
Direct Data Upload
Content Moderation
Data Security
Data Verification
Big Data Practice
COS Cost Optimization Solutions
Using COS in the Third-party Applications
Migration Guide
Migrating Local Data to COS
Migrating Data from Third-Party Cloud Storage Service to COS
Migrating Data from URL to COS
Migrating Data Within COS
Migrating Data Between HDFS and COS
Data Lake Storage
Cloud Native Datalake Storage
Metadata Accelerator
GooseFS
Data Processing
Data Processing Overview
Image Processing
Media Processing
Content Moderation
File Processing Service
File Preview
Troubleshooting
Obtaining RequestId
Slow Upload over Public Network
403 Error for COS Access
Resource Access Error
POST Object Common Exceptions
API Documentation
Introduction
Common Request Headers
Common Response Headers
Error Codes
Request Signature
Action List
Service APIs
Bucket APIs
Object APIs
Batch Operation APIs
Data Processing APIs
Job and Workflow
Content Moderation APIs
Cloud Antivirus API
SDK Documentation
SDK Overview
Preparations
Android SDK
C SDK
C++ SDK
.NET(C#) SDK
Flutter SDK
Go SDK
iOS SDK
Java SDK
JavaScript SDK
Node.js SDK
PHP SDK
Python SDK
React Native SDK
Mini Program SDK
Error Codes
Harmony SDK
Endpoint SDK Quality Optimization
Security and Compliance
Data Disaster Recovery
Data Security
Cloud Access Management
FAQs
Popular Questions
General
Billing
Domain Name Compliance Issues
Bucket Configuration
Domain Names and CDN
Object Operations
Logging and Monitoring
Permission Management
Data Processing
Data Security
Pre-signed URL Issues
SDKs
Tools
APIs
Agreements
Service Level Agreement
Privacy Policy
Data Processing And Security Agreement
Contact Us
Glossary

Common Options

PDF
Mode fokus
Ukuran font
Terakhir diperbarui: 2025-11-12 16:22:47
You can view the general options supported by COSCLI using the ./coscli --help or ./coscli -h command.

Option Description

The following are common options for COSCLI, which can be used in all its commands:
Note:
We recommend using the tool with temporary keys to enhance security through temporary authorization. When applying for temporary keys, please follow the principle of least privilege to prevent leakage of resources beyond the target bucket or object.
If you must use a permanent key, we recommend you follow the Notes on Principle of Least Privilege to limit the scope of permission on the permanent key.
Option
Note
-h, --help
Outputs help information. You can view the help information and usage of the tool with the -h or --help command. You can also enter -h after each command (with no parameter appended) to see how to use the command. For example, to view the specific usage of the bucket creation command, enter coscli mb -h.
-c, --config-path
Configuration file path, which is ~/.cos.yaml for COSCLI by default. You can also specify a custom configuration file by adding -c after a command.
-e, --endpoint
In addition to configuring the region of a bucket in advance in the configuration file, you can also use -e in COSCLI to specify the bucket endpoint in the format of cos.<region>.myqcloud.com, where <region> represents the bucket region, such as ap-guangzhou and ap-beijing. For the list of regions supported by COS, see Regions and Access Endpoints.
-i, --secret-id
Specifies the SecretId used to access COS.
-k, --secret-key
Specifies the SecretKey used to access COS.
--session-token
Access COS with a temporary key.
-v, --version
Displays the COSCLI version.
-p, --protocol
Network transfer protocol, which is HTTPS by defaul.
--init-skip
By default, it is false. If it is set to true (--init-skip=true), skip the config init interactive operation, and directly use the SecretId, SecretKey, and endpoint parameters to request the APIs. When this parameter is used, the -i, -k, and -e parameters must be configured.
--log-path
Customize the coscli.log file location, in the same directory as COSCLI by default. Specify a directory or specific file (the file must end with .log), for example: /data/ or /data/coscli.log.
--customized
By default, it is false. When set to true, enable the custom domain name and specify it using the --endpoint (-e) parameter.
--disable-log
Defaults to false. When set to true, it disables the generation of coscli.log and the output of corresponding logs.
--bucket-type
Specify the current bucket access type (COS/OFS).

Sample

Example 1: Switching bucket to upload an object

When you need to switch to a bucket in another region through COSCLI, you can use the -e option to specify the endpoint of the bucket.
For example, to upload the local file test.txt to the bucket examplebucket-1250000000 in the Chengdu region with the endpoint cos.ap-chengdu.myqcloud.com, run the following command:
./coscli cp test.txt cos://examplebucket-1250000000/test.txt -e cos.ap-chengdu.myqcloud.com

Example 2: Switching user account to view the file list

When you need to use the identity of another account, you can use the -i and -k options to specify the SecretId and SecretKey of your key respectively.
For example, to use the identity of another account to list the files in the bucket examplebucket-1250000000 in the Chengdu region, run the following command:
./coscli ls cos://examplebucket-1250000000 -e cos.ap-chengdu.myqcloud.com -i ******************************** -k ********************************


Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan