ls -a, ls -l & hidden files
See everything, in detail
Lesson 3 of 20 · 8 min · Module 1: Find your way around
Some files hide by default. Others carry useful details you only see when you ask for them.
Start this lesson →Free. No installation: you write and run the code in your browser, and it is checked automatically.
By the end, you’ll be able to…
- Show hidden files
- Read a long listing
- Combine short options
The idea
A name that starts with a dot, like .bashrc, is a hidden file. ls -a shows all files, including hidden ones. ls -l shows a long listing: permissions, owner, size, date, and name. Options can be combined: ls -la.
ls -a
ls -l projects/scripts
01Hidden is not secret
A leading dot only hides a file from a plain ls. It is a convention for settings files such as .bashrc and .profile, which you rarely need to see.
02Read a long listing from left to right
In -rwxr-xr-x 1 learner learner 39 Oct 19 09:00 hello.sh, the first character is - for a file or d for a folder. The next nine characters are permissions, then the owner, the group, the size in bytes, the date, and the name.
ls -l projects/scripts-rw-r--r-- 1 learner learner 79 Oct 19 09:00 backup.sh
-rwxr-xr-x 1 learner learner 39 Oct 19 09:00 hello.sh03Options combine
ls -l -a and ls -la mean the same thing. Most commands accept several single-letter options after one dash. ls -lh also shows sizes in a human-friendly unit.
Your turn
projects/scripts so you can see the permissions and sizes.What the checks look for
- Reveals the hidden .bashrc file
- Shows the long listing for projects/scripts
Take this with you
Options change how a command answers: -a shows more, -l shows more detail.
Go a little further
Run ls -lh on the logs folder and compare the size column with ls -l.