|
1 | | -# s6cmd |
| 1 | +# s6cmd |
| 2 | + |
| 3 | +[](https://github.com/LinPr/s6cmd/releases) |
| 4 | +[](https://golang.org/) |
| 5 | +[](LICENSE) |
| 6 | + |
| 7 | +*s6cmd is stiall under developing, please do not use it in your production environment.* |
| 8 | + |
| 9 | +s6cmd is a command-line tool for Amazon S3, using [aws-sdk-go-v2](https://github.com/aws/aws-sdk-go-v2), since the aws has announced the [aws-sdk-go](https://github.com/aws/aws-sdk-go) is deprecated. It's inspired by the popular [s3cmd](https://s3tools.org/s3cmd) tool and aims to provide similar functionality with improved performance and modern Go architecture. |
| 10 | + |
| 11 | +## Features |
| 12 | + |
| 13 | +s6cmd currently supports the following S3 operations: |
| 14 | + |
| 15 | +- **Bucket Operations** |
| 16 | + - `mb` - Make bucket (create S3 bucket) |
| 17 | + - `rb` - Remove bucket (delete S3 bucket) |
| 18 | + - `ls` - List buckets and objects |
| 19 | + |
| 20 | +- **Object Operations** |
| 21 | + - `put` - Upload files to S3 |
| 22 | + - `get` - Download files from S3 |
| 23 | + - `cp` - Copy objects within S3 |
| 24 | + - `mv` - Move/rename objects in S3 |
| 25 | + - `rm` - Remove objects from S3 |
| 26 | + - `stat` - Display object metadata |
| 27 | + - `du` - Display disk usage for objects |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | +## Installation |
| 32 | + |
| 33 | +### Download Pre-built Binaries |
| 34 | + |
| 35 | +Download the latest release for your platform from the [releases page](https://github.com/LinPr/s6cmd/releases): |
| 36 | + |
| 37 | +```bash |
| 38 | +# Linux AMD64 |
| 39 | +wget https://github.com/LinPr/s6cmd/releases/latest/download/s6cmd-linux-amd64 |
| 40 | +chmod +x s6cmd-linux-amd64 |
| 41 | +sudo mv s6cmd-linux-amd64 /usr/local/bin/s6cmd |
| 42 | + |
| 43 | +# macOS ARM64 (Apple Silicon) |
| 44 | +wget https://github.com/LinPr/s6cmd/releases/latest/download/s6cmd-darwin-arm64 |
| 45 | +chmod +x s6cmd-darwin-arm64 |
| 46 | +sudo mv s6cmd-darwin-arm64 /usr/local/bin/s6cmd |
| 47 | +``` |
| 48 | + |
| 49 | +### Build from Source |
| 50 | + |
| 51 | +```bash |
| 52 | +git clone https://github.com/LinPr/s6cmd.git |
| 53 | +cd s6cmd |
| 54 | +go build -o s6cmd . |
| 55 | +``` |
| 56 | + |
| 57 | +## Configuration |
| 58 | + |
| 59 | +s6cmd uses AWS credentials and configuration, similar to the AWS CLI. You can configure it using: |
| 60 | + |
| 61 | +### Environment Variables |
| 62 | +```bash |
| 63 | +export export AWS_ENDPOINT_URL_S3=your-object-storage-service-endpoint |
| 64 | +export AWS_ACCESS_KEY_ID=your-access-key |
| 65 | +export AWS_SECRET_ACCESS_KEY=your-secret-key |
| 66 | +export AWS_REGION=your-object-storage-region |
| 67 | +``` |
| 68 | + |
| 69 | +### AWS Credentials File |
| 70 | +```bash |
| 71 | +aws configure |
| 72 | +``` |
| 73 | + |
| 74 | +### Configuration File |
| 75 | +Create a configuration file at `config/s6cmd.yaml`: |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | +## Usage |
| 80 | + |
| 81 | +### Basic Examples |
| 82 | + |
| 83 | +```bash |
| 84 | +# List all buckets |
| 85 | +s6cmd ls |
| 86 | + |
| 87 | +# List objects in a bucket |
| 88 | +s6cmd ls s3://my-bucket/ |
| 89 | + |
| 90 | +# Upload a file |
| 91 | +s6cmd put local-file.txt s3://my-bucket/remote-file.txt |
| 92 | + |
| 93 | +# Download a file |
| 94 | +s6cmd get s3://my-bucket/remote-file.txt local-file.txt |
| 95 | + |
| 96 | +# Copy objects within S3 |
| 97 | +s6cmd cp s3://source-bucket/file.txt s3://dest-bucket/file.txt |
| 98 | + |
| 99 | +# Sync local directory with S3 |
| 100 | +s6cmd sync ./local-dir/ s3://my-bucket/prefix/ |
| 101 | + |
| 102 | +# Display bucket structure |
| 103 | +s6cmd tree s3://my-bucket/ |
| 104 | + |
| 105 | +# Create a new bucket |
| 106 | +s6cmd mb s3://my-new-bucket |
| 107 | + |
| 108 | +# Remove objects |
| 109 | +s6cmd rm s3://my-bucket/file.txt |
| 110 | + |
| 111 | +# Show object statistics |
| 112 | +s6cmd stat s3://my-bucket/file.txt |
| 113 | +``` |
| 114 | + |
| 115 | +### Global Flags |
| 116 | + |
| 117 | +```bash |
| 118 | +# Dry run mode (show what would be done without executing) |
| 119 | +s6cmd put -n local-file.txt s3://my-bucket/file.txt |
| 120 | + |
| 121 | +# Get help for any command |
| 122 | +s6cmd help |
| 123 | +s6cmd put --help |
| 124 | +``` |
| 125 | + |
| 126 | +## Architecture |
| 127 | + |
| 128 | +s6cmd is built using: |
| 129 | + |
| 130 | +- **[AWS SDK for Go v2](https://github.com/aws/aws-sdk-go-v2)** - Modern, efficient AWS SDK |
| 131 | +- **[Cobra](https://github.com/spf13/cobra)** - CLI framework for Go |
| 132 | +- **[Viper](https://github.com/spf13/viper)** - Configuration management |
| 133 | + |
| 134 | + |
| 135 | +## Development Status |
| 136 | + |
| 137 | +s6cmd is actively under development. While it already provides essential S3 operations, we're continuously adding new features and improvements. |
| 138 | + |
| 139 | + |
| 140 | + |
| 141 | +## License |
| 142 | + |
| 143 | +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
| 144 | + |
| 145 | +## Acknowledgments |
| 146 | + |
| 147 | +- Inspired by [s3cmd](https://s3tools.org/s3cmd) - The original S3 command-line tool |
| 148 | +- Built with the excellent [AWS SDK for Go v2](https://github.com/aws/aws-sdk-go-v2) |
| 149 | + |
| 150 | + |
0 commit comments