How to list files and folders

Overview

ls lists a directory. With options it can show hidden names, ownership, permissions, sizes, and modification times.

Examples

ls
ls -l
ls -la
ls -lh ~/Downloads
ls *.txt

Useful options

  • -l shows detailed long format
  • -a includes dotfiles and the ./.. entries
  • -h makes sizes easier to read when used with -l
  • -t sorts newest first; -r reverses sorting
  • -d lists a directory itself rather than its contents

Tips

Linux names are case-sensitive. Quote paths containing spaces, and use Tab completion to reduce typing errors.

A long listing begins with the item type and permissions; a directory starts with d and a regular file with -.