Available in Classic and VPC
Get the list of buckets, folders, or objects.
Syntax
The ls syntax is as follows:
aws s3 ls \
[<s3-uri>] \
[--recursive] \
[--page-size <page-size>] \
[--human-readable] \
[--summarize] \
--endpoint-url <endpoint-url>
Options
This section describes the options available when running ls.
Optional options
These are the optional options for ls. Options that are not specified will use their default values.
| Options | Type | Required | Description |
|---|---|---|---|
<s3-uri> |
String | Optional | S3 URI for a bucket or path
|
--recursive |
Boolean | Optional | Retrieves sub-prefixes under the specified path. |
--page-size |
Integer | Optional | Number of items per page
|
--human-readable |
Boolean | Optional | Displays object sizes in human-readable units such as bytes, KiB, MiB, GiB, etc. |
--summarize |
Boolean | Optional | Displays the total number of objects and their total size in the query results. |
Common options
For information about the options common to all aws subcommands, see Object Storage options.
Examples
If the request to retrieve the list is successful, the bucket name or the object's last modified date and time, size, and name are displayed.
Command
The following is an example command to get the list of all buckets owned by the account.
aws s3 ls \
--endpoint-url=https://kr.object.ncloudstorage.com
The following is an example command for listing the objects in a bucket.
aws s3 ls s3://my-test-bucket \
--endpoint-url=https://kr.object.ncloudstorage.com
The following is an example command for checking the total number of objects and the size of a bucket.
aws s3 ls s3://my-test-bucket \
--recursive \
--human-readable \
--summarize \
--endpoint-url=https://kr.object.ncloudstorage.com
Output
The following is an example output for retrieving a list of all buckets owned by an account.
2026-04-28 10:31:27 my-docs-bucket
2026-09-02 14:30:20 my-backup-bucket
2026-08-19 11:36:46 my-test-bucket
The following is an example output for retrieving the list of objects in a bucket.
PRE docs/
PRE img/
2026-09-02 15:41:01 5242880 large.bin
2026-09-02 14:33:24 24 notes.txt
2026-09-02 14:33:23 46 sample.txt
The following is an example output for retrieving the total number and size of objects in a bucket.
2026-09-02 14:33:23 41 Bytes docs/report.txt
2026-09-02 15:39:50 70 Bytes img/image.png
2026-09-02 15:41:01 5.0 MiB large.bin
2026-09-02 14:33:24 24 Bytes notes.txt
2026-09-02 14:33:23 46 Bytes sample.txt
Total Objects: 5
Total Size: 5.0 MiB