Skip to content

Linux commands: ls

A quick guide to the ls command, used to list the files in a folder

Inside a folder you can list all the files that the folder contains using the ls command:

ls

If you add a folder name or path, it will print that folder contents:

ls /bin

ls accepts a lot of options. One of my favorite options combinations is -al. Try it:

ls -al /bin

compared to the plain ls, this returns much more information.

You have, from left to right:

This set of data is generated by the l option. The a option instead also shows the hidden files.

Hidden files are files that start with a dot (.).

This command works on Linux, macOS, WSL, and anywhere you have a UNIX environment


→ Here's my latest YouTube video

→ Get my Linux Command Line Handbook

→ I wrote 17 books to help you become a better developer, download them all at $0 cost by joining my newsletter

JOIN MY CODING BOOTCAMP, an amazing cohort course that will be a huge step up in your coding career - covering React, Next.js - next edition February 2025

Bootcamp 2025

Join the waiting list