LAB-NAV-03 - Listing Like a Pro
Listing Like a Pro
Use `ls` variants to inspect directory contents, reveal hidden files, and sort by time or size when the basic list is not enough.
- Choose a useful `ls` variant for a real question instead of using the same default list every time.
- Repeat the workflow without copy-paste or step-by-step prompting.
Part A: The Field Guide
What and Why
A plain ls is useful, but it answers only one question: “what names are here?”
Real work requires better questions:
- which files are hidden?
- which file changed most recently?
- which file is largest?
- what permissions are visible from the listing?
That is where flags matter.
A Few High-Value Variants
ls ls -la ls -lh ls -lt ls -lS ls -ld /etc
What each one helps with
ls -la-> see hidden files and long detailsls -lh-> make sizes human-readablels -lt-> sort by most recent changels -lS-> sort by sizels -ld /path-> inspect the directory itself, not its contents
Common beginner misunderstanding
When a directory shows a small size in ls -lh, that is not the total size of everything inside it. It is only the directory entry itself. Later you will use other tools for full directory size.
Part B: The Drill Deck
Terminal Required: Use your Linux terminal for these exercises.
G Guided Step by step - type exactly this and compare the result >
Exercise G1: Long and hidden
- Go to your home directory.
- Run
ls -l. - Run
ls -la. - Identify what appeared only after adding
-a.
Exercise G2: Human-readable sizes
- Run
ls -lhin a directory with a few files. - Compare it mentally to the plain byte counts you would see without
-h.
Exercise G3: Sort by time
- Go to
/var/logif it exists. - Run
ls -lt. - Identify the most recently changed item.
S Solo Task described, hints available - figure it out >
Exercise S1: Choose the right flag
For each question, decide which command is best and then run it:
- I need to see hidden files in my home directory.
- I need to know which file changed most recently.
- I need to see sizes in a readable format.
- I need to inspect
/etcitself, not everything inside it.
Exercise S2: Compare outputs
Run these and explain the difference:
lsls -lals -lhls -lt
Exercise S3: One real question
Pick one directory on your system and answer a real question about it, such as:
- what changed most recently?
- what hidden files are here?
- which visible file is largest?
Use the ls variant that best matches the question.
M Mission Real scenario - no hints, combine multiple skills >
Mission M1: Recent activity check
Use one command sequence to find the most recently modified item in a directory that changes often, such as /var/log or your Downloads folder.
Then explain why your chosen flags matched the question.
Mission M2: Directory inspection without noise
Inspect the /etc directory itself rather than flooding the screen with its contents.
Then explain why -d changes the behavior so much.