s3cmd uses

s3cmd is a command-line tool for managing Amazon S3 (Simple Storage Service). It allows you to perform various S3 operations such as uploading files, downloading files, copying files, deleting files, etc. through the command line interface.

Here are some common s3cmd commands and usage examples:

  1. Install the s3cmd tool:

    pip install s3cmd
    
  2. Configure the s3cmd tool:

    s3cmd --configure
    

    This will walk you through configuration, including providing AWS access keys, default region, and more.

  3. List all buckets:

    s3cmd ls
    
  4. Create a new bucket:

    s3cmd mb s3://bucket-name
    

    Replace "bucket-name" with the name of the bucket you wish to create.

  5. Upload a local file to the bucket:

    s3cmd put /path/to/local/file s3://bucket-name/remote-file-name
    

    Replace "/path/to/local/file" with the path to the local file, "bucket-name" with the bucket name, and "remote-file-name" with the file name in S3 after upload.

  6. Download files from storage bucket to local:

    s3cmd get s3://bucket-name/remote-file-name /path/to/local/file
    

    Replace "bucket-name" with your bucket name, "remote-file-name" with the name of the file you want to download, and "/path/to/local/file" with your local save location.

  7. Copy files to another bucket:

    s3cmd cp s3://source-bucket-name/source-file s3://destination-bucket-name/destination-file
    

    Replace "source-bucket-name" with your source bucket name, "source-file" with your source file name, "destination-bucket-name" with your destination bucket name, and "destination-file" with your destination file name .

  8. Delete the files in the bucket:

    s3cmd rm s3://bucket-name/file-to-delete
    

    Replace "bucket-name" with the bucket name and "file-to-delete" with the name of the file to delete.

These are some basic usage examples of s3cmd. You can run s3cmd --helpor consult the official documentation of s3cmd to get more detailed information on commands and options.

Guess you like

Origin blog.csdn.net/m0_55877125/article/details/131916316