• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

“aws s3 ls” Command Examples

by admin

The aws s3 ls command is a part of the AWS Command Line Interface (CLI) and is used to list AWS S3 buckets, folders (prefixes), and files (objects). It provides a convenient way to retrieve information about the contents of your S3 storage.

Here’s an overview of the aws s3 ls command and its functionality:

  • Listing S3 Buckets: When executed without any additional arguments, the aws s3 ls command returns a list of all your S3 buckets. This includes the names and creation dates of the buckets.
  • Listing Objects in a Bucket: By specifying the bucket name as an argument, the aws s3 ls command can list the objects (files) stored within a specific S3 bucket. It provides information such as the object name, size, and last modified timestamp.
  • Listing Objects with Prefixes/Folders: The aws s3 ls command can list objects within a specific “prefix” or folder in an S3 bucket. By specifying the bucket name and a prefix, you can retrieve a list of objects within that particular folder or prefix.
  • Recursive Listing: The aws s3 ls command provides an option (–recursive) to perform a recursive listing of objects. This allows you to retrieve a complete listing of all objects within a bucket or a specific prefix, including objects within subfolders.
  • Output Formats: The aws s3 ls command supports different output formats, such as table, JSON, or CSV. You can choose the format that best suits your needs and use it to process or further analyze the listing information.

The aws s3 ls command is particularly useful when you need to explore the contents of your S3 storage, identify specific objects or folders, or perform automated operations based on the listing results.

aws s3 ls Command Examples

1. List all buckets:

# aws s3 ls

2. List files and folders in the root of a bucket (s3:// is optional):

# aws s3 ls s3://bucket_name

3. List files and folders directly inside a directory:

# aws s3 ls bucket_name/path/to/directory/

4. List all files in a bucket:

# aws s3 ls --recursive bucket_name

5. List all files in a path with a given prefix:

# aws s3 ls --recursive bucket_name/path/to/directory/ prefix

6. Display help:

# aws s3 ls help

Filed Under: AWS, Cloud, Linux

Some more articles you might also be interested in …

  1. ldconfig Command Examples in Linux
  2. apt-key: command not found
  3. swapoff: command not found
  4. How to Enable Password Aging in Linux with NIS
  5. mh_lint Command Examples
  6. less Command Examples
  7. clangd: Language server that provides IDE-like features to editors
  8. “git am” Command Examples
  9. “git range-diff” Command Examples
  10. glib-compile-resources Command Examples

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright