Practice Use drills for recall and labs for real operating judgment.

LAB-NAV-03 - 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.

NAV Navigation Mastery

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.

45 min BEGINNER LINUX Field-verified
Success criteria
  • 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

Useful Listing 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 details
  • ls -lh -> make sizes human-readable
  • ls -lt -> sort by most recent change
  • ls -lS -> sort by size
  • ls -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

  1. Go to your home directory.
  2. Run ls -l.
  3. Run ls -la.
  4. Identify what appeared only after adding -a.

Exercise G2: Human-readable sizes

  1. Run ls -lh in a directory with a few files.
  2. Compare it mentally to the plain byte counts you would see without -h.

Exercise G3: Sort by time

  1. Go to /var/log if it exists.
  2. Run ls -lt.
  3. 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:

  1. I need to see hidden files in my home directory.
  2. I need to know which file changed most recently.
  3. I need to see sizes in a readable format.
  4. I need to inspect /etc itself, not everything inside it.

Exercise S2: Compare outputs

Run these and explain the difference:

  1. ls
  2. ls -la
  3. ls -lh
  4. ls -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.