aws-s3-ls
List objects in an Amazon S3 bucket
TLDR
List all buckets
List files and folders in the root of a bucket (s3:// is optional)
List files and folders directly inside a directory
List all files in a bucket
List all files in a path with a given prefix
Display help
SYNOPSIS
aws s3 ls [s3://BUCKET[/PREFIX]] [--human-readable] [--recursive] [--summarize] [--page-size INTEGER]
PARAMETERS
--human-readable, --hr
Display file sizes in human-readable format (e.g., 1.2 KiB, 3.4 MiB)
--page-size
Number of objects to return per paginated response (default varies by service)
--recursive, --r
Recursively list contents of all sub-prefixes (directories)
--summarize, --sum
Show only summary info (total count and bytes), skip individual listings
DESCRIPTION
The aws s3 ls command is a high-level subcommand of the AWS Command Line Interface (CLI) designed to list Amazon S3 storage buckets, object prefixes, or individual objects. When invoked without arguments, it displays all S3 buckets owned by the authenticated AWS account, including creation dates.
Specifying a bucket path like s3://my-bucket lists top-level objects and common prefixes (subdirectories) within that bucket. Adding a prefix, such as s3://my-bucket/path/, narrows the output to matching contents. Output includes object keys, last modified dates, sizes, and storage classes.
Key features include human-readable file sizes (e.g., '1.2 KiB'), recursive listing for deep directory structures, summarization for totals only (skipping individual items), and pagination control for large result sets. It respects AWS IAM permissions, so only accessible resources appear.
This command is ideal for quick inspections, scripting bucket inventories, or verifying uploads without downloading data. It leverages AWS SDK under the hood for efficient, multipart-aware operations but remains user-friendly compared to low-level aws s3api alternatives. Always ensure AWS credentials are configured via aws configure or environment variables for authentication.
CAVEATS
Lists only buckets/objects accessible via IAM permissions; paginates large results (use --page-size or --no-paginate); requires configured AWS credentials; no delete or modify capabilities.
COMMON EXAMPLES
List all buckets: aws s3 ls
List bucket contents: aws s3 ls s3://my-bucket
Recursive with summary: aws s3 ls s3://my-bucket --recursive --summarize --human-readable
OUTPUT FORMAT
Default tabular: "2023-01-01 12:00:00 1234567 myfile.txt"; pipe to jq with --query for JSON.
HISTORY
Introduced in AWS CLI v1.7.0 (2015) as part of high-level S3 commands for simplified workflows; enhanced in v2.x with better pagination and output formatting; aligns with AWS SDK evolutions.


