nerdexam
LPI

010-150 · Question #7

Which of the following commands will display a list of all files in the current directory, including those that may be hidden?

The correct answer is A. ls -a. The ls -a option is the correct flag to display all files in a directory, including hidden files whose names begin with a dot.

Initial Client Consultation and Assessment

Question

Which of the following commands will display a list of all files in the current directory, including those that may be hidden?

Options

  • Als -a
  • Bls --hidden
  • Cls -h
  • Dls --a

How the community answered

(63 responses)
  • A
    75% (47)
  • B
    14% (9)
  • C
    8% (5)
  • D
    3% (2)

Why each option

The ls -a option is the correct flag to display all files in a directory, including hidden files whose names begin with a dot.

Als -aCorrect

ls -a instructs ls to list all directory entries including those starting with '.', which are hidden by default, as well as the special entries '.' (current directory) and '..' (parent directory).

Bls --hidden

ls --hidden is not a valid option recognized by the GNU coreutils ls implementation and will produce an unrecognized option error.

Cls -h

ls -h enables human-readable output for file sizes (e.g., displaying '4.0K' instead of '4096') and has no effect on which files are displayed.

Dls --a

ls --a is not a valid long-form ls option and will result in an error; the correct short option is -a (single hyphen).

Concept tested: Listing hidden files using ls -a

Source: https://man7.org/linux/man-pages/man1/ls.1.html

Topics

#ls command#hidden files#directory listing#Linux CLI

Community Discussion

7
Ingrid P.Ingrid P.Jan 30, 2026

A is correct. The -a flag tells ls to include entries whose names begin with a dot, which is how Linux hides files, so without it those files simply do not appear in the output.

15
Yusuf A.Yusuf A.Feb 1, 2026

Good point, and worth adding that -a actually shows . and .. too, so if you just want the hidden files without those two directory entries, -A is the cleaner flag to reach for.

0
Yusuf A.Yusuf A.Feb 16, 2026

ls -a is the one because the -a flag tells ls to include entries starting with a dot, which is how Linux hides files like .bashrc or .ssh. My senior had me run that on a fresh home directory and I was surprised how many hidden config files were already sitting there.

4
Viktor S.Viktor S.Feb 19, 2026

Yusuf nailed it, though worth being precise that -a shows ALL dot entries including the . and .. directory pointers themselves, so if you want just the hidden files without that noise, ls -A (capital A) is the cleaner habit to build.

0
Ola B.Ola B.Feb 6, 2026

ls -a is right, the -a flag includes dot files.

3
Ingrid P.Ingrid P.Feb 8, 2026

Right, and worth adding that -A skips the . and .. entries that -a includes, which is usually what you actually want when you care about hidden files.

0
Viktor S.Viktor S.Feb 11, 2026

ls -h is the trap here because "h" looks like it should mean hidden but it actually means human-readable sizes, which trips up a lot of people. The real answer is ls -a, where the "a" stands for all, and that is what shows you dotfiles and the . and .. entries.

1
Full 010-150 Practice