ls lists what’s inside a folder: its files and the folders within it. Type ls and the folder’s name.
Every command and output on this page is real, run in Terminal with zsh 5.9 on macOS 26.
Syntax
Syntax
ls [folder]
ls: the command that lists a folder.folder: the folder to list. Leave it out to list the folder you’re in.
See ls in the POSIX standard.
The Example
A folder named notes with three text files, and next to it a file named todo.txt.
Step 1: List a Folder
Terminal
ls notes
Output
monday.txt tuesday.txt wednesday.txt
Step 2: List the Folder You’re In
Terminal
ls
Output
notes todo.txt
With no name, ls lists the current folder: here the notes folder and the todo.txt file.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
A wrong folder name, such as ls note | ls: note: No such file or directory | Check the name’s spelling |
FAQ
Why are the names side by side?
In a Terminal window, ls arranges the names in columns to fit the width of the window.
Conclusion
Type ls and a folder’s name to see what’s in it, or ls alone for the folder you’re in.
Additional Resources
- ls (POSIX standard)
macOS is a trademark of Apple Inc.
