ls

Prev Next

Available in Classic and VPC

Get a bucket, folder, or object list.

Commands

The command statement is as follows:

aws s3 ls <target> --endpoint-url <value> [--options]

Parameter

The following describes the parameters.

Parameter Type Required Description Restrictions
--endpoint-url <value> string Y Specify the default URL for command calls. It is only available for the KR Region. See Ncloud Storage overview for call domain information.
--recursive boolean N Apply command scope to subdirectories. -
--page-size <value> integer N -
--human-readable boolean N Provide file size in units such as Bytes/MiB/KiB/GiB. -
--summarize boolean N Display total number and size of objects. -
--debug boolean N Use debug logging. -
--no-verify-ssl boolean N Redefine the default behavior for validating SSL certificates. -
--no-paginate boolean N Disable automatic pagination, call only the first page for results. -
--output <value> string N Specify the format of call results. Available options
- json
- text
- table
- yaml
- yaml-stream
--query <value> string N JMESPath query to use for filtering response data -
--profile <value> string N Use a specific profile in the credentials file. -
--region <value> string N Specify the Region. Only KR is supported.
--color <value> string N Set output color. Available options
- on
- off
- auto
--no-sign-request boolean N Disable credential loading. -
--ca-bundle <value> string N Specify the CA certificate to use when verifying SSL certificates. -
--cli-read-timeout <value> int N Maximum read time; entering 0 changes it to a blocked status instead of a timeout. It is set to 60 seconds by default.
--cli-connect-timeout <value> int N Maximum connection time; entering 0 changes it to a blocked status instead of a timeout. It is set to 60 seconds by default.
--no-cli-pager boolean N Disable the CLI pager for response values. -
--cli-auto-prompt boolean N Enable automatic prompting for CLI input parameters. -
--no-cli-auto-prompt boolean N Disable automatic prompting for CLI input parameters. -

Examples

This section describes an example of calling and responding to the ls command.

Get bucket list

Call examples

If you use the command without any targets or options, all buckets owned by the account are listed. The following is a call example.

aws s3 ls --endpoint-url=http://kr.ncloudstorage.com 

Response example

The response example is as follows:

2024-12-24 16:37:28 bucket-a
2024-12-24 16:37:44 bucket-aa
2024-11-22 01:27:16 bucket-log

Get object list of specific bucket

Call examples

If you specify the bucket you want to query and use the command, all prefixes and object lists in the bucket will be listed. If you want to query objects under a specific prefix, add / at the end of the bucket path. The following is a call example.

aws s3 ls s3://bucket-aa --endpoint-url=http://kr.ncloudstorage.com 

Response example

The response example is as follows:

                           PRE log-2412/
2024-12-24 17:10:34    2077405 document1.pdf
2024-12-24 17:10:34    1747272 document2.pdf
2024-12-24 16:55:08      79238 image.png
2024-12-24 16:55:10      69182 image5.png
2024-12-24 16:55:10     858176 ncloudstorage.pptx

Get prefix of specific bucket and all objects under it

Call examples

--recursive option allows you to query all objects under the prefix, and --summarize option allows you to check the total number and size of objects stored in the bucket or under a specific prefix. The following is a call example.

aws s3 ls s3://bucket-aa --endpoint-url=http://kr.ncloudstorage.com --recursive --human-readable --summarize

Response example

The response example is as follows:

2024-12-24 17:10:34    2.0 MiB document1.pdf
2024-12-24 17:10:34    1.7 MiB document2.pdf
2024-12-24 16:55:08   77.4 KiB image.png
2024-12-24 16:55:10   67.6 KiB image5.png
2024-12-27 11:46:17    0 Bytes log-2412/
2024-12-27 11:48:47  387 Bytes log-2412/241201120224.txt
2024-12-27 11:48:47  387 Bytes log-2412/241202120123.txt
2024-12-27 11:48:47  387 Bytes log-2412/241203120012.txt
2024-12-24 16:55:10  838.1 KiB ncloudstorage.pptx

Total Objects: 9
Total Size: 4.8 MiB