Linux command
aws-s3-ls 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
List all S3 buckets
aws s3 ls
List objects
aws s3 ls s3://[bucket-name]/
List objects
aws s3 ls s3://[bucket-name]/[prefix/]
Recursively list
aws s3 ls s3://[bucket-name] --recursive
List with human-readable sizes
aws s3 ls s3://[bucket-name] --recursive --human-readable --summarize
List buckets
aws s3 ls --bucket-name-prefix [my-prefix]
说明
aws s3 ls lists S3 objects and common prefixes under a specified prefix, or lists all S3 buckets when no URI is provided. The output shows the last modified date, size, and object key for each item. When listing bucket contents, objects are displayed with timestamps and sizes, while common prefixes (similar to directories) are shown with a PRE indicator. The command supports recursive listing to show all objects under a prefix.
参数
- --recursive
- List all objects under the specified prefix, including nested objects
- --human-readable
- Display file sizes in human-readable format (KB, MB, GB)
- --summarize
- Display summary information including total number of objects and total size
- --page-size _value_
- Number of results to return in each response (default: 1000)
- --request-payer _value_
- Confirm that the requester will pay for request and data transfer costs
- --bucket-name-prefix _value_
- Filter bucket list to names beginning with the specified prefix
- --bucket-region _value_
- Filter bucket list to buckets in the specified AWS Region
FAQ
What is the aws-s3-ls command used for?
aws s3 ls lists S3 objects and common prefixes under a specified prefix, or lists all S3 buckets when no URI is provided. The output shows the last modified date, size, and object key for each item. When listing bucket contents, objects are displayed with timestamps and sizes, while common prefixes (similar to directories) are shown with a PRE indicator. The command supports recursive listing to show all objects under a prefix.
How do I run a basic aws-s3-ls example?
Run `aws s3 ls` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --recursive do in aws-s3-ls?
List all objects under the specified prefix, including nested objects