How to list all S3 buckets and contents of a bucket

Below is the command to list all S3 buckets owned by you:

aws s3 ls

To list all the contents of an S3 bucket

aws s3 ls s3://bucketname

To list all the contents of an S3 bucket and it’s folders recursively:

aws s3 ls s3://bucketname --recursive
See also  How to change Sort key of a table in Redshift database