Camp 1 · Step 3 of 12
ls and exploring
List files, reveal hidden ones, and read the details — your eyes in the terminal.
10 min+50 XP
You can move around (cd) and know where you are (pwd). Now: see
what's here. That's ls — list.
The basics
$ ls
notes.txt photos projects todo.mdBare ls lists the current folder's contents. Point it elsewhere without
moving:
ls projects # list what's inside projects
ls /etc # list a folder by absolute pathOptions unlock detail
Commands accept flags — usually a letter after a dash — that change
behavior. ls has two you'll use forever:
ls -a # ALL files, including hidden ones
ls -l # LONG format: permissions, size, date
ls -la # both at once (flags combine!)ls -l output, decoded:
-rw-r--r-- 1 ada staff 1240 Jul 15 09:30 notes.txt
▲ ▲ ▲ ▲ ▲ ▲
permissions owner group size date nameHidden files
Files starting with a dot (.gitignore, .env, .bashrc) are hidden
from a plain ls — a convention for configuration you don't want cluttering
the view. ls -a reveals them:
$ ls -a
. .. .gitignore notes.txt projects(. is this folder, .. the parent — the same ones you cd into.)
Checkpoint
Which command reveals hidden dotfiles like .gitignore?
Checkpoint
What does the -l flag add to ls output?