---
title: "S3cmd for Managing S3 Object Storage | Hostman Docs"
description: "Use S3cmd tool for managing S3 object storage with Hostman’s documentation. Perform uploads, downloads, and sync easily."
---

> For the complete documentation index for AI agents, see [llms.txt](https://hostman.com/llms.txt).

S3cmd is an S3 API client with a command-line interface, used to interact with [S3-compatible storage](https://hostman.com/products/s3-storage/).

## Installation

To install S3cmd, use the following commands.

-   Ubuntu:

```shell
sudo apt install s3cmd -y
```

-   CentOS:

```shell
sudo dnf install s3cmd -y
```

-   Arch Linux:

```shell
sudo pacman -S s3cmd
```

-   MacOS (using [Homebrew](https://brew.sh/)):

```shell
brew install s3cmd
```

-   Windows (using [Chocolatey](https://chocolatey.org/install)):

```shell
choco install s3cmd -y
```

Make sure to run PowerShell as an administrator.

## Configuration

To configure S3cmd to work with our [S3 object storage](https://hostman.com/products/s3-storage/), you need to create a `.s3cfg` file in your home directory with the following contents:

```shell
[default]
access_key = <Access Key>
secret_key = <Secret Access Key>
bucket_location = us-2
host_base = s3.hmstorage.net
host_bucket = s3.hmstorage.net
use_https = True
```

You can find **Access Key** and **Secret Access Key** in the bucket **Settings** under **S3 parameters**.

![1cac3c1a 9cb3 4fce B15c Ec12634e9a78](https://content.hostman.com/assets/e2b1589a-f280-43b7-bbc4-cbeb32b8e632.png?width=1540&height=1596)

## Usage Examples

### Listing Files in a Bucket

To list the files in a bucket, use the `ls` command:

```shell
s3cmd ls s3://<bucket_name>
```

### Uploading a Local File to a Bucket

To upload files, use the `put` command. In the example below, the file `text.txt` is uploaded:

```shell
s3cmd put test.txt s3://<bucket_name>
```

### Multipart Upload

The S3cmd client supports multipart upload, which is automatically enabled for files larger than 15 MB. This method splits the file into multiple parts (chunks) and uploads them in parallel, speeding up large file transfers and improving fault tolerance.

If needed, multipart upload can be disabled using the `--disable-multipart` option.

To change the size of individual chunks, use the `--multipart-chunk-size-mb=SIZE` option, where `SIZE` is the size of each chunk in megabytes. By default, the chunk size is 15 MB, with a minimum allowable size of 5 MB and a maximum of 5 GB.

For example, to set the chunk size to 10 MB, use the following command:

```shell
s3cmd put <file_name> --multipart-chunk-size-mb=10 s3://<bucket_name>
```

This setting allows you to optimize large file uploads based on network bandwidth and performance requirements.

### Managing Interrupted Multipart Uploads

If a multipart upload is interrupted, file fragments do not appear in the bucket but still occupy disk space on the server. To view a list of interrupted uploads and see which fragments are using space, use the following command:

```shell
s3cmd multipart s3://<bucket_name>
```

This command shows the date and time the upload started, the file path, and a unique upload identifier (ID).

To delete fragments from failed uploads, use this command:

```shell
s3cmd abortmp s3://<bucket_name>/<file_name> <upload_ID>
```

### Downloading a File from a Bucket

To download a file from a bucket to your local device, use `get`:

```shell
s3cmd get s3://<bucket_name>/test.txt
```

### Deleting a File in a Bucket

To delete a file, use the `del` command. In the example below, we delete the file `text.txt`:

```shell
s3cmd del s3://<bucket_name>/test.txt
```

### File Synchronization

To synchronize files between a local directory (in this example, the current directory: `.`) and a bucket, use `sync`:

```shell
s3cmd sync . s3://<bucket_name>
```

For a full list of commands and additional information, consult the [S3cmd documentation](https://s3tools.org/usage).
