CLI Reference¶
The hafiz CLI provides an AWS CLI-compatible interface for Hafiz.
Installation¶
Configuration¶
hafiz configure
# Endpoint URL: http://localhost:9000
# Access Key: hafizadmin
# Secret Key: hafizadmin
Or use environment variables:
export HAFIZ_ENDPOINT=http://localhost:9000
export HAFIZ_ACCESS_KEY=hafizadmin
export HAFIZ_SECRET_KEY=hafizadmin
Commands¶
| Command | Description |
|---|---|
ls |
List buckets or objects |
cp |
Copy files |
mv |
Move files |
sync |
Synchronize directories |
rm |
Remove objects |
mb |
Make bucket |
rb |
Remove bucket |
head |
Get object metadata |
cat |
Stream object content |
du |
Disk usage |
presign |
Generate presigned URL |
configure |
Manage configuration |
Quick Examples¶
# List buckets
hafiz ls s3://
# Upload file
hafiz cp file.txt s3://my-bucket/
# Download file
hafiz cp s3://my-bucket/file.txt ./
# Sync directory
hafiz sync ./local/ s3://my-bucket/backup/
# Delete object
hafiz rm s3://my-bucket/old-file.txt