Skip to content

ls ​

List the contents of a bucket:

sh
s3m ls backup/backups

Cloudflare R2

Since 0.25.0, listing a whole bucket on R2 works without --prefix (s3m ls cloudflare/my-bucket, and du, rm --older-than and monitor rules on a whole bucket), and so does listing the buckets (s3m ls cloudflare). Older versions failed with XML parse error: missing field Prefix or 501 NotImplemented.

To list available buckets:

sh
s3m ls backup

To list in-progress multipart uploads:

sh
s3m ls backup/backups --multipart

-p/--prefix ​

To list the content of a bucket with a specific prefix:

sh
s3m ls backup/backups --prefix test

-n/--number ​

List at most three results across all pages. With --older-than, only matching objects count. A limit of 0 lists nothing.

sh
s3m ls backup/backups --number 3

--start-after ​

To continue a bucket listing after a specific key, pass its full key. With --multipart, this skips all uploads for that key.

sh
s3m ls backup/backups --prefix daily/ --start-after daily/backup-01.tar

--older-than ​

List only objects whose LastModified is strictly older than the given duration:

sh
s3m ls backup/backups --older-than 30d

Supported duration forms:

  • Nd
  • Nh
  • Nm

--json ​

Return machine-readable JSON instead of terminal-formatted output:

sh
s3m ls backup/backups --json

Bucket listing also supports JSON:

sh
s3m ls backup --json

Released under the BSD License.