Click the virtual machine below to start practicing
- Setting up virtual machine…
- Preparing lab files…
- Starting terminal services…
This lab machine has stopped
Your progress through the guide is saved. Start a fresh machine to keep practicing.
Click the virtual machine below to start practicing
Your progress through the guide is saved. Start a fresh machine to keep practicing.
ls lists what's in a directory. ~/project has a few files to explore, including a hidden one.
This lab is the hands-on companion to the ls (List Directories) lesson from Linux Journey (CC BY-SA 4.0).
With no argument, ls lists the current directory. Give it a path to list somewhere else:
ls
ls /etc
You didn't have to move to see inside /etc.
Names starting with . are hidden. -a shows everything:
ls -a
. .. .config-backup budget.csv movie.mp4 notes.txt photos
-l gives one line per entry with permissions, owner, size and date. -h makes sizes readable:
ls -l
ls -lh
-rw-r--r-- 1 learner learner 2.0M Oct 18 10:02 movie.mp4
-t sorts newest first and -r reverses any order:
ls -lt
ls -ltr
budget.csv hasn't changed in months, so it ends up first with -ltr.
Single-letter options can be combined. Show everything, long format, readable sizes:
ls -lah
ls lists the current directory; ls path lists another.-a includes hidden dot-files.-l shows details and -h makes sizes readable.-t sorts by time and -r reverses the order.ls -lah.