nerdexam
LPI

010-150 · Question #82

Which command lists all files in the current directory that start with a capital letter?

The correct answer is A. ls [A-Z]*. Shell glob patterns use bracket expressions like [A-Z] to match character ranges, and the asterisk wildcard matches any subsequent characters.

The Power of the Command Line

Question

Which command lists all files in the current directory that start with a capital letter?

Options

  • Als [A-Z]*
  • Bls A-Z
  • Cls A-Z*
  • Dls --uppercasefiles
  • Elist-uppercase-files

How the community answered

(48 responses)
  • A
    75% (36)
  • B
    8% (4)
  • C
    2% (1)
  • D
    13% (6)
  • E
    2% (1)

Why each option

Shell glob patterns use bracket expressions like [A-Z] to match character ranges, and the asterisk wildcard matches any subsequent characters.

Als [A-Z]*Correct

The pattern [A-Z]* uses a bracket expression to match any single uppercase letter A through Z as the first character, followed by * which matches zero or more of any characters. This correctly instructs ls to list only files whose names begin with a capital letter.

Bls A-Z

ls A-Z treats 'A-Z' as a literal filename, not a pattern, so it would only look for a file actually named 'A-Z'.

Cls A-Z*

ls A-Z* treats 'A-Z' as a literal prefix, only matching files whose names literally start with the string 'A-Z', not any uppercase letter.

Dls --uppercasefiles

--uppercasefiles is not a valid ls option.

Elist-uppercase-files

list-uppercase-files is not a valid Unix command.

Concept tested: Shell glob patterns with bracket expressions

Source: https://www.gnu.org/software/bash/manual/bash.html#Pattern-Matching

Topics

#glob patterns#ls command#wildcards#file listing

Community Discussion

5
Thiago A.Thiago A.Jun 15, 2026

A is correct. The square bracket glob [A-Z]* tells the shell to match any filename whose first character falls in the range A through Z, then the asterisk matches the rest of the name, so ls [A-Z]* lists exactly what you want, nothing more, nothing less.

16
Samuel O.Samuel O.Jun 26, 2026

A is right. The square brackets tell the shell to match any single character in that range, so [A-Z]* expands to anything starting with a capital letter, which is standard glob syntax you will use constantly once you start scripting in Linux.

3
Wesley A.Wesley A.Jun 6, 2026

A is the one you want. The square brackets make it a glob pattern that matches any single character in the range A through Z, so ls [A-Z]* expands to every entry whose name starts with an uppercase letter, while options like ls A-Z or ls A-Z* just look for a literal hyphen in the filename.

1
Imani T.Imani T.Jun 6, 2026

That is exactly right, and worth adding that the behavior can vary slightly depending on locale settings since some environments interpret character ranges based on collation order rather than strict ASCII, so LC_ALL=C is your friend if you want purely uppercase A through Z with no surprises.

0
Imani T.Imani T.Jun 18, 2026

ls [A-Z]* is the one you want here, because the square brackets tell the shell to match any single character in that range, and the asterisk handles the rest of the filename. Quick follow-up though, do you know what happens when you run ls [a-z]* on a case-insensitive filesystem versus a case-sensitive one, and why that matters for the exam?

1
Full 010-150 Practice